ASP.NET MVC 3 is the third major version of Model-View-Controller extension for developing web applications in a .NET framework
0
votes
1answer
31 views
Using AutoMapper in ASP.Net MVC
I'd like to check my understanding and usage of the AutoMapper in my ASP.Net MVC app.
I setup the maps in Application_Start:
Mapper.CreateMap<Customer, CustomerViewModel>();
...
1
vote
2answers
31 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 ...
0
votes
0answers
41 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 ...
3
votes
3answers
224 views
How to refactor this property's code?
I have a view model with properties that represent years and months:
public IEnumerable<SelectListItem> Years
{
get
{
return new SelectList(
Enumerable.Range(1900, ...
0
votes
0answers
74 views
MembershipProvider with Entity Framework and IoC in asp.net MVC3
I am using Castle Windsor as my IoC and I registered it as DependencyResolver to let MVC framework know about it.
With Entity Framework I have this DbContext:
public class MyDbContext : DbContext
{
...
1
vote
0answers
33 views
ASP.NET MVC - Help needed to Improve the code for Drop-Down Box?
I have created the below drop-down to populate a list of cities.
All works fine, but I would like to know the better ways of doing this please. Also, please let me know if it is possible to create ...
1
vote
2answers
88 views
Is my code (clean code separation) is correct?
The code below is an approach of clean code separation, but I am confused if it is a right approach or wrong. Please suggest me.
public interface IRepository<T>
{
...
3
votes
0answers
369 views
Correct usage of EF's DBContext in ASP.NET MVC application with Castle Windsor
I am trying to use Entity Framework as simple as posible. Use UnitOfWork and Repository patterns seems to be overkill because whole web application will be pretty straightforward. I came with this ...
3
votes
2answers
86 views
Is it ok to use HttpContext inside View?
I have a pretty common issue: i need to know the name of current user and also name of the current controller so i can highlight/disable some links.
Here's some solutions i found by myself:
1: Get ...
6
votes
2answers
217 views
Is this user input field secure?
I'm pretty new to asp and c# and I have a couple of concerns with the security of the code I have written (shown below). Basically all it does is allow you to enter a quantity before you add the item ...
2
votes
2answers
559 views
Wrapper for jquery ajax to ensure redirects occur on clientside
Recently I had the need to make some ajax calls within a MVC 3.0 with Razor and jQuery application. After a bit of trial and error and refactoring it was discovered that a number of different needs ...
1
vote
2answers
986 views
Search and Filter in MVC3 Razor I am using Linq, is there a better way to do this
Heres my Code and it works fine. I just dont like all the If else, what If I keep adding field to filter, its going to get messy. Ps: I am not using EF and cannot on this. Thanks.
CONTROLLER CODE
...
3
votes
3answers
103 views
What standard should I use for the naming of my MVC controller services?
I have the following:
public class ContentsController : BaseController {
private IContentService _content;
private IPageService pageService;
private IReferenceService ...
3
votes
1answer
242 views
Creating a list of pairs after splitting the string containing all of the sets
I am working on asp.net/MVC and I need to read a value from my web.config file. Splitting the list into multiple keys is not an option.
<add key="DepartAssign" value="Depart1:PersonAssignTo1; ...
3
votes
1answer
382 views
Asp.net MVC login method
I wrote this login method:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel logModel, string returnUrl)
{
if (!ModelState.IsValid)
{
...