ASP.NET MVC 3 is the third major version of Model-View-Controller extension for developing web applications in a .NET framework

learn more… | top users | synonyms

3
votes
2answers
124 views

User Login Logic

I want to see if this is as streamlined as possible. Most of the logic is accomplished through methods in the model. The controller does one of four things: redirects new users to registration ...
2
votes
2answers
86 views

Return custom assembly attribute variables

I have a custom attribute in my assembly called SemverAttribute, and I have a helper class called AppInfo that has a function to return a number called the Semver number. It accepts an id of null-6. ...
4
votes
1answer
187 views

Using static management class to control db transactions through an EF6

I have the class below to manage my specific implementation of a membership system using entity framework 6.1 Is the use of static access correct in this case? as far as I understood that EF context ...
0
votes
0answers
58 views

Adding viewstate based property and implication in future converstion to MVC in ASP.NET forms project

Supposedly adding another viewstate based property in user control (riddled with similar properties) incur technical debt in future effort to convert projects to MVC (comment made by one of my ...
2
votes
1answer
3k views

When to use separate DBContext classes?

I know that the DBContext represents a session (Unit-Of-Work and Repository) with the database, however I an unsure as to when I should have a different DBContext. Currently, I have a separate ...
1
vote
1answer
4k 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: ...
3
votes
3answers
368 views

View model with properties that represent years and months

I have a view model with properties that represent years and months: ...
5
votes
0answers
325 views

MembershipProvider with Entity Framework and IoC

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: ...
2
votes
1answer
100 views

Drop-down for populating a list of cities

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 ...
0
votes
2answers
175 views

Is my code (clean code separation) is correct? [closed]

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. ...
10
votes
1answer
7k 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
401 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: Get all ...
6
votes
2answers
335 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
4k 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 ...
4
votes
2answers
7k views

Search and filter in MVC3 Razor using Linq

This code works fine, but I just don't like all the if else. If I keep adding field to filter, it's going to get messy. I am not using EF and cannot on this. ...
3
votes
3answers
127 views

What standard should I use for the naming of my MVC controller services?

I have the following: ...
3
votes
1answer
2k 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. ...
3
votes
1answer
1k views

Asp.net MVC login method

I wrote this login method: ...
3
votes
3answers
1k views

Self populating view models

So I have a view model (asp.net mcv 3 app) that when instantiated with a particular parameter, populates it's properties via a couple of calls to a web service in it's constructor. ...
5
votes
2answers
532 views

Is there a better way of writing this action method using Linq?

I have an ASP.Net MVC3 web application that displays a list of parts (A part is a simple entity with a number and a description). I have updated the action method to support filtering and paging: ...
13
votes
3answers
4k views

What's “The Right Way” to Separate Models and ViewModels?

I have a central domain assembly which contains various rich domain models. Lots of business logic, etc. To keep this example simple, here's probably the simplest one: ...
6
votes
2answers
2k views

ASP.NET MVC using an N-Tier Model and DDD

Any comments are welcome. However I'd like to call specific attention to my... interpretation of the N-Tier application architecture and how I'm consuming data. Note that the namespacing and inline ...
1
vote
0answers
334 views

Amazon S3 pass-through controller

I am building a website that uses Amazon S3 to host its image (and other) files. I require that images displayed on the website look like they come from my site and not from Amazon (so we are talking ...
1
vote
2answers
773 views

Many to many crud using entity framework 4.1

My view submits data to the controller using Json objects which contains child objects.It allows users to add/remove/modify the relationship with child entities(authors,categories,LIbraryBookCopy). ...
5
votes
1answer
510 views

This LINQ Model Query seems extremely inefficient

I'm new to LINQ, but I have some background in T-SQL. I know there are probably 100 different ways to design a T-SQL statement that would run this much more efficiently, but I'm not sure how I would ...
13
votes
1answer
2k views

Fluent LinkedIn REST API client interface design

There is a handful of LinkedIn clients written in C# on the NuGet package library, but afaict most only do authentication via LinkedIn. I found a couple which offer a linkedin rest api interface. Of ...
7
votes
2answers
547 views

Custom Authentication Attribute

I was trying to find a way to redirect to different pages on authorization and authentication failure. I found this to be a possible solution. However, I ended with a different solution by myself. It ...
1
vote
1answer
318 views

Fluent NHibernate, Getting or Creating a new `Tag`

Edit The rest of my code utilises the Command/Query seperation pattern. I'll probably move this out into a command and a query but for now I've written this directly in my MVC controller for brevity. ...
36
votes
4answers
32k views

EF Code First with Repository, UnitOfWork and DbContextFactory

I am about to >explode< :) due to amount of reading on this subject... My head hurts, and I need some honest opinions... There is a similar question/review that I noticed, but I believe my approach ...
4
votes
2answers
6k views

Passing an array of values in Url.Action

I need to pass an array of values in Url.Action. Currently I'm doing: ...
4
votes
1answer
335 views

Loading data from a remote app

I have a method which loads data from a remote app (send TCP request and parse response). Now, I have a simple class for sending a TCP request: ...
2
votes
2answers
213 views

Am I approaching this ASP.Net MVC/Entity Framework pattern incorrectly?

I have experience is C#/ASP.NET, and I've done MVC in Ruby On Rails, so I figured making the jump to ASP.NET MVC would be a breeze. Unfortunately, I'm second-guessing my every decision. I'd like ...
0
votes
1answer
424 views

Is there a prettier or more performant way to create an MVC Pager Helper?

I've got this MVC Pager Helper and it's working exactly as expected. I'm wondering if there's a prettier or more performant way to build this out? Also, I know that the StringBuilder might not be the ...
2
votes
2answers
355 views

How can I avoid all this code duplication?

As you can see I have to populate the ViewModel with the List of Tags so that the dropdown can have all the options for the user to select. And I have to do this 2 times for the Create Action and 2 ...
3
votes
1answer
3k views

Is this a workable UnitOfWork with Repository pattern design?

I am building a web app with using UOW and Repository pattern. I have seen many different samples and found each one to be different, so not sure which is the correct way to go. I have a basic ...
3
votes
0answers
840 views

ASP.NET MVC 3 ModelBinder with string sanitizing

I need to allow incoming HTML in string parameters in my projects action methods, so we have disabled Input Validation. I have a good HTML sanitizer; the review I am interested in is the way I bound ...
1
vote
3answers
97 views

Improving readability and logic on “re-indexing” method

This is a method which takes an input of a "page" object, which includes SortOrder. It then fetches the existing page items from a database and attempts to re-index. I don't think this is at all ...
3
votes
0answers
539 views

MVC Async Action Invoking Workflow

I've just started working with Workflow (WF4) and have been playing with an idea of using it in MVC3.0 controller actions to see if it improves the maintainability of complex actions; also potentially ...
7
votes
1answer
193 views

Is this appropriate way to pass data from presentation to application layer?

What is the best practices to pass data from presentation to application layer? Currently I have something like this: in presentation layer: the controller: ...
8
votes
1answer
733 views

Efficient way to deal with maintaining Many:Many relationships in EF Code-First

I've got this all working, but it seems to be quite long-winded, and I thought I'd post here and see if I'm doing it wrong... I have a M:M relationship between an Installer and a MasterInstance. The ...
4
votes
1answer
3k views

ASP.NET MVC models that can be validated without using attributes

The model looks like this, with no attributes: ...
4
votes
1answer
527 views

LINQ generating chart

I'm generating a table to use on jQuery visualize plugin and generate a chart. The code is pretty good, but maybe there is a way to improve it. Maybe do more work on the LINQ query and less stuff on ...
2
votes
3answers
238 views

ASP.NET MVC Html.XXFor OK to discard lambda argument and just use Model directly?

I find it a bit odd in ASP.NET MVC that the Html helper extensions, like Html.EditorFor, take a ...
3
votes
1answer
4k views

nTier architecture for an MVC application

I am endeavoring to build my first non-trivial web application and so I'd like to confirm a couple of design decisions. I have three tiers as follows: UI (my MVC project) Business Logic (separate ...
2
votes
0answers
757 views

Model validation from within the Service Layer

I'm interested in the idea of not having my BLL dependent on ASP.NET MVC. This means that I would like to have model binding occur within my service layer. But I want to take advantage of ASP.MVC's ...
2
votes
0answers
983 views

Using WIF with ASP MVC 3 for authorization [closed]

What can be the best way to implement custom authorization attribute in MVC 3 using claims? For example we have claims: ...
3
votes
2answers
2k views

Old-way of asynchronous programming in ASP.NET MVC 3

On ASP.NET MVC, I try to write an async Controller action with the old asynchronous programming model (actually, it is the current one, new one is still a CTP). Here, I am trying to run 4 operations ...
0
votes
1answer
133 views

Is there any javascript pitfalls with this approach that I might be missing?

I have a model with a number of complex/simple properties that has a corresponding strongly typed view, that calls EditorFor to a custom editor template view for the model. One of the form's ...
1
vote
1answer
297 views

Refactoring of my code

I'm new in ASP.NET MVC (using MVC 3). Could you inspect (refactoring) my code, to advise, or anything else? Maybe something can be rewritten in a more compact. A few details about site: on main ...
8
votes
1answer
20k views

MVC Custom Authentication, Authorization, and Roles Implementation

Bear with me as I provide details for the issue... I've got an MVC site, using FormsAuthentication and custom service classes for Authentication, Authorization, ...