Model-View-Controller for the ASP.NET framework

learn more… | top users | synonyms

-4
votes
0answers
25 views

ASP.NET MVC - Onion Architechure [on hold]

I've been looking into the Onion Architecture for an upcoming project using ASP.NET MVC 6. I think I have a pretty good understanding of how the architecture should look like and why I should be using ...
1
vote
0answers
31 views

Simple tracking online users in ASP.NET

I wrote simple online users tracking for my ASP.NET MVC project. In Global.asax I added: ...
1
vote
1answer
26 views

Using [ChildActionOnly] for generating links

I have a view which displays a list of items, in each row I'm going to have a link, a link in each row points to different location So base upon a property called ...
6
votes
1answer
126 views

Embedding an RSS feed into a page after it's already loaded

I'm working on reworking our website from a WYSIWYG editor to MVC. I'm all right with server side code, but complete rubbish when it comes to client side Javascript, so I'd appreciate any/all ...
2
votes
1answer
50 views

Validating user access to a function

I was reviewing the following code block and noticed there was validation check at the top. The 3rd line in the function checks if the invoice belongs to the logged in customer. I am wondering ...
3
votes
1answer
35 views

Generic Object Editing Classes with Controller, ViewModelProvider and DBUpdater

I am beginning to use generics and would like feedback on the following set of classes that will serve as the basis for an app that contains a large number of basic CRUD-y entities. I have used ...
2
votes
0answers
28 views

Unit Testing With Dependency Injection and MOQ

I'm just learning how dependency injection and mocking work, but I'd like some feedback on how I'm setting up a couple of tests. I can get them to pass, but I'm not sure this is all I need. This is ...
7
votes
3answers
286 views

Implementing IDisposable

I am developing a class (in a C# MVC 5 project) that originally had a using block within a single method, and it got to be very huge after placing formatting ...
7
votes
1answer
126 views

MVC binding list of values to checkboxlist in an efficient way

I have this code which generates and shows list of selectable items that user can post to controller in order to save into database. Model looks like this: ...
2
votes
0answers
36 views

Safe implementation for extending authentication cookie with user data

After searching around and reading through articles and answers I came up with this implementation for extending the cookie of Forms Authentication. But I am not 100% sure that I did not introduce any ...
3
votes
2answers
125 views

Keeping data processing out of controllers

I would like to start by mentioning that I am LAMP stack guy who happens to be making my first ever .NET C# web app and I'm seeking general advises for best practices and to see how more experienced ...
1
vote
1answer
101 views

AngularJS: Http API Service - any improvements / remarks?

Could you please review the below AngularJS service. What it does is centralize all (relevant) HTTP action calls. Do you see any chances for improvement?: ...
5
votes
1answer
144 views

Combating magic strings in a web application

I'm on a quest to combat all the magic strings which tends to pile up in an ASP.NET MVC application. All reviews will be highly appreciate but please note that: Some of the classes contains more ...
3
votes
2answers
67 views

View Model Constructor Arguments

I have created a ViewModel for a Product Edit page because it has specific related entities I need to load - the class currently looks like this: ...
0
votes
1answer
107 views

Method GetById and SingleResult

Here is my method that I use to get one entity in an ASP.NET Web API application. ...
4
votes
2answers
189 views

A set of Razor HTML helpers for disabling elements

I am developing a huge form with a lot of elements in it. The purpose of this form is editing one domain entity. Now, I finished developing the whole form and it just shows the bunch of text boxes, ...
2
votes
0answers
70 views

Business logic in controller

Led by the recently read premise "Lean controllers and fat models" I've come to the conclusion that my controller might be too fat at the moment. Basically, what I'm trying to achieve is simple Edit ...
3
votes
3answers
385 views

Master detail INSERT in Entity Framework 6 Database First MVC 5

I have a DB with a master table called "facturas" and another detail table "facturas_detalle." I would like to insert to them, so this is a "Database-First". I need some guidance or advise of best ...
1
vote
2answers
69 views

Implementing Search method For a Class

In my web app, I have a view where users can search in receipts and drafts. I've implemented this ability in search method at my view model, but I'm not sure if this is the best place to put it. So ...
4
votes
1answer
99 views

Checking locked users using Identity 2.0

I'm writing a theoretical MVC application to aid in learning more about ASP Identity 2. In real terms I'm new to ASP Identity as a whole but thought I'd jump in in this release as it's the default ...
0
votes
0answers
44 views

Adding a link on page with current URL (including hash) in a querystring

I'm trying to add a link to a page. The link should contain the current URL in a querystring (to be used as a ReturnUrl) and it can contain a hash. ...
5
votes
2answers
92 views

Writing a thin navigation controller

I'm trying to achieve a thin controller, and I started out with a thin controller but over time as the project has progressed the controller has got more complex. Could you please review the following ...
6
votes
1answer
69 views

Highlight Current Link

I'm using this technique for highlighting current links (e.g. how the "Questions" link is highlighted on this very page you're looking at). I changed the code a little bit and came up with this ...
3
votes
1answer
137 views

Choose the right type for method GetById

I designed my repository class and I need some advice from you. Now I have a method GetByID that returns a generic type: ...
2
votes
1answer
66 views

Method that return related entities using OData

There is method GetFull that should use OData return related entities. When I call GetFull(12, "entity1,entity2") then I will ...
1
vote
2answers
155 views

Getting a user's property

Can this extension method be improved? ...
3
votes
1answer
99 views

WebApi action that updates entity using stored procedure

I have ASP.NET WebApi project. Some of controller has method SetAsMain(int id) that get information about people then use stored procedure update people. How can I ...
3
votes
1answer
366 views

Run stored procedure from repository using EF

I need to dynamically call a stored procedures from my repository, and here is a my implementation: ...
6
votes
2answers
107 views

Storing an integer counter in indexer

I've been implementing a custom internal server error page in ASP.Net MVC which will check if the current user is either an administrator or accessing the page from localhost, and if so, show them a ...
6
votes
1answer
186 views

Helper for DropDownLists with extension method

Is the following helper idiomatic ASP.NET MVC? All the built-in DropDownListFor helpers only accept ...
6
votes
3answers
424 views

Monkeying around with Survey Monkey and Asp.Net Mvc

Intro I've been a desktop dev for a long time now, and have never really had to monkey with web development until very recently. I have a need to do some custom integration with Survey Monkey's Api ...
5
votes
4answers
274 views

Generic Repository For Web Apps

I was developing a web app using Entity Framework 6 and MVC 5. For the data access layer, I eased the job and wrote a generic repository as following: ...
1
vote
3answers
245 views

Partial view for frequently used drop down lists

I have one input that is needed in many forms, so I created a partial view for that. In the partial view I query the database and generate a drop down list. I just want to make sure, this is the best ...
3
votes
2answers
186 views

MVC-Web API 2 integration

For the first time ever, I'm integrating an MVC website to an ASP.NET Web API 2 web service (both of which are coded by myself). I'd appreciate it if you can just look this over for me and let me ...
2
votes
2answers
93 views

Basic survey app

I am learning MVC 5 .NET and this is a bit different than Rails activerecord when creating relations. I have created a basic survey app that has a Survey class and this relates to the questions and ...
2
votes
0answers
305 views

N-Layer using MEF dependency injection on MVC project

I'm trying to create a "perfect" generic solution structure for MVC (5.2.3.0) projects using MEF. Currently my solution looks like this. Core layer contains generic classes that could be used in ...
0
votes
0answers
60 views

Address validation unit test

This is an example of a unit test I've just written for an ASP.NET controller action to test whether the model's RequiresClassification flag is set to true. The ...
1
vote
0answers
437 views

Populating Charts with Chart.js

I have a dashboard page which populates some charts. They execute a Linq query to then transform the data into Json to populate the Chart. These charts maybe used throughout the site, so I am ...
3
votes
1answer
225 views

Including functions in _ViewStart.cshtml

I've got the following code in my _ViewStart.cshtml file: ...
2
votes
2answers
275 views

Checking for user permissions

The idea here is we have Roles, Permissions, and a table called PermissionRoles that connect the two. So a Permissions can be in many Roles, and many Permissions can have the same Role. So what the ...
3
votes
2answers
99 views

MVC refactoring parameter check

I had this code repeated in many Actions: ...
1
vote
1answer
136 views

Method that checks whether to disable or enable the buttons depending on whether data is null or not

I have this bit of code that needs refactoring/simplification. The below grabs the planning data for view A and B. Then it joins the planning and matching image for view details. So then it determines ...
5
votes
1answer
312 views

Pagination implementation for a blog system

Last night I was working on a project that I've embarked upon as a learning exercise. I decided to add a pagination feature to my blog system. I made an attempt at it and got close... but I decided to ...
2
votes
1answer
139 views

Is it an anti-pattern to let ViewModel fill itself from a domain object? [closed]

Let's say you have a Employees table mapped to a Employee class. Now you want to code a Edit page for general information. You need a ViewModel with all the properties you need to build the page, so ...
1
vote
2answers
135 views

Code separation in MVC

Firstly I am not a professional programmer and I am just learning C#, MVC and Web Development. Much of what I describe here is self taught and comes from lots of googling and posts on Stack Overflow. ...
2
votes
2answers
977 views

MVC N-Tier Architecture

I am working on a new MVC web application, so the project is in early stages. I have created 4 projects. Let me explain what they do: Common --> contains all my DTOs, enums helpers, ViewModels ...
1
vote
0answers
131 views

Passing values to a partial view

I have button which I would like to use for update and create actions. Currently a create action is based on the URL parameter equalling 0 . If for instance, in a ...
1
vote
1answer
319 views

Check if modelitem refers to currently logged in user with mvc identity

I'm using MVC in order to generate a couple of views within my webpage. For a way of logging in, I've decided to use Asp.net's Identity, which I am very happy with. However, I'm trying to find an ...
1
vote
1answer
242 views

Using ASP.NET identity in a new app

I need code review for using ASP.NET Identity in a new app. Goals: Use int instead of GUID for IDs. Separate identity from view layer I need code review if I ...
2
votes
1answer
1k views

Adding data to the DB in EF without using navigation properties

Questions: Is there a better way other than assigning IDs manually and creating separate lists for each model the way I have? (for this particular scenario). If so, how? (Still taking the conditions ...