ASP.NET MVC 4 is the fourth major version of the ASP.NET Model-View-Controller platform for web applications.
-2
votes
0answers
17 views
Where to keep data about an authenticated user? [closed]
I am still pretty new to ASP.NET Web API. I am currently working on the authentication part of a new application based on Web API, which is developed using some libraries/kinda framework of the ...
2
votes
1answer
70 views
Please help me follow Repository Pattern properly
I am new to learning Repository Pattern. I am developing a site in MVC 4 ( I m new to it as well). The way I am using Repository pattern as follows:
I created IRepository<T> interface as ...
1
vote
1answer
68 views
How can I make this code better
I hate having almost two identical blocks do almost the exact same thing.
I am working with Entity Framework 4.4.0.0
Asp.Net MVC
Right now if the user is a "manager" I want to show them the entire ...
3
votes
1answer
44 views
Using AJAX to interact with MVC
I have the following ajax call:
function getPreviewText() {
$.ajax({
type: 'POST',
url: '@Url.Action("PreviewWiki")',
dataType: 'json',
data: 'source=' + ...
-1
votes
0answers
25 views
JSON/JQuery to create alert notification [closed]
I'm working in ASP MVC & C#, and what i'm trying to do is something similar to the following.
public JsonResult SendMessage(SMSTestViewModel model)
{
if (//logic here)
{
...
1
vote
1answer
32 views
Making a property virtual to cause EF to load the property?
I am walking through a sample MVC4 ASP.Net tutorial available on PluralSight.com, by Scott Allen. I am in a section #5, Working with Data (part 2), "Listing Reviews".
This application has a database ...
1
vote
0answers
65 views
Select list items in ViewModel fetched using a Repository
Doing database access in ViewModel is generally considered a bad practice. However, when you have a <select> in your view, you need to populate it using the ViewBag or the ViewModel (I prefer ...
-1
votes
1answer
121 views
ASP.NET MVC 4 Shopping Cart - Cannot update shopping car items using JQuery , Ajax, jSON, jGrid [closed]
I have this code in a C# MVC 4 VS2012 project. I need to be able to update the shopping cart with jSON data using JQuery/AJAX, i'm using jqGrid to display the data and pulling the shopping cart items ...
1
vote
0answers
53 views
Best practices in implementing service methods
Consider the following architecture: ASP.NET MVC Application having controllers which depend on service classes (MembershipService, EmailService etc.) which in turn depend on data access context ...
1
vote
2answers
48 views
MVC : Does code to save data is session or cache belongs in controller?
I'm a bit confused if saving the information to session code below, belongs in the controller action as shown below or should it be part of my Model?
I would add that I have other controller methods ...
1
vote
1answer
79 views
Truncate port number from absolute Uri
We had a requirement to remove the port number from the Request.Url.AbsoluteUr i.e
Actual:
https://mysitename:443/Home/Index
Excepted:
https://mysitename/Home/Index
The code I used for ...
2
votes
1answer
75 views
Cropping and combining two images on server
I've coded following two methods to combine images that are HTTP POSTed to the server:
// Crops two squares out of two separate images
// And then combines them into single image that's returned as ...
1
vote
0answers
55 views
A Repository for Good ASP.NET MVC Practices
I have an open source project on GitHub. It is an ASP.NET MVC 4 application using Entity Framework and a handful of other utilities. I decided to create this project after spending about a year ...
1
vote
1answer
132 views
MVC4 Linq to Sql Model Structure
Goal: To pass a list of related objects into a view which can then be iterated over using razor syntax.
I'm new to LINQ and MVC4. I'm trying to use the repository pattern to manage my model creation. ...
3
votes
0answers
76 views
Injecting SelectList objects into ViewData to enable using EditorFor on dropdown based properties?
I have developed a system whereby I use an attribute to state which SelectList to use for an 'FK' property. I would appreciate some feedback mainly on by good practice, and also on any ways to do this ...
3
votes
0answers
232 views
Is this the right way to inject AutoMapper profiles
I'd like to know if I'm doing profile configuration in the wrong place or in the wrong way.
I'm following the Onion Architecture. So that restricts the direction of my dependencies towards the ...
6
votes
1answer
131 views
passing a selectlist to the view based on database models from viewmodel is a MVC anti-pattern?
We need to select a model reference from a view.
To do this we need to add a dropdownlistfor.
this is based on a selectlist containing database models.
passing selectlists by viewbag
this solves our ...
1
vote
1answer
132 views
What should I do to improve my first MVC 4 application built with C#
I've started learning .NET with MVC 4 in C# and I built a basic application to display records from a MySQL database. It's incredibly basic, but it's the best I could come up with being a complete ...
0
votes
0answers
55 views
modal window with form
First, Sorry for my English.
I'm very new in web development. I want that you make code review of my code.
I have profile page where contains two tabs:User Info and Violations. In the User Info tab ...
1
vote
0answers
26 views
PBKDF2 Authorization first go, is this optimal?
I've discovered that using hashed passwords with salts is much better idea than MD5/SHA256 so I'm not hashing them with PBKDF2. However I'm wondering if this is correct approach to authorize my user. ...
1
vote
1answer
926 views
Entity Framework & Unit Of Work Design issue with Repository & DI, Please Help
I am facing a problem to save data using UnitOfWork. I mean I am unable to save data using UnitOFWork.Commit() from Controller class. My Implementation check bellow.
IUnitOfWork
public interface ...
1
vote
1answer
102 views
How to dynamically Generate Sort strings for Data Layer from Controller
I need help refactoring this code to dynamically generate a sort string that I can send to my data layer so that my database does the sorting instead of it happening in memory. I am using MVC4 with ...
0
votes
2answers
158 views
How could I make my controller a little less hideous?
I have a controller. It functions as follows:
A user imports a file and decides whether the files contents contain new entries to be placed into a database, or existing entries entries to be updated.
...
0
votes
1answer
90 views
Products table or Products + attributes when using EF + MVC 4 [closed]
What I need to build is a web application that maintains and shows products. A product has a lot of attributes, some that will be changed or added during the next year. I have 2 options for designing ...
4
votes
4answers
384 views
Is this bad code? (Instantiating if null)
I often have static classes which uses the DataContext somehow, and they all make a new DataContext, but often i allready have one instantiated elsewhere, so why not use that?. And then i would do ...
5
votes
1answer
677 views
ListBox for a many to many relationship
I'm looking for a good and easy to use solution for creating MultiSelectLists in MVC for many to many relationships.
I have this following example code and it works fine, but it just takes a lot of ...
1
vote
0answers
191 views
Need help in implementing Repository Pattern with Custom Membership ASP.NET MVC
I am implementing Repository Pattern in one of my project based on ASP.NET MVC4 and N-Tier Architecture. I am little confused as how to implement Custom Membership with Repository Pattern. Here are ...
4
votes
1answer
920 views
Can someone review my AutoFac, NHibernate & ASP.NET Web API integration?
I've recently been learning (and struggling with) integrating AutoFac, NHibernate & ASP.NET Web API. I have found several tutorials with code that did not work as anticipated but managed to ...
2
votes
0answers
461 views
Using a recurring System.Threading.Timer in an Mvc Application
I'd like your opinion on something. I have the following class:
public class ApplicationClock
{
void tick(object _)
{
lock (tickLock)
{
try
{
...