Model-View-Controller for the ASP.NET framework

learn more… | top users | synonyms

3
votes
2answers
96 views

User can add and delete customers

I am using asp.net core entitiy framework. The page displays the customers. The user can add new customers or delete existing ones. I am looking for ways to improve my code. Here is my cshtml page ...
1
vote
0answers
96 views
+50

Redirection with params - No query string

I have a products page with a search box. When a search is submitted there's a redirection to a search results page. If another search is submitted then the ...
3
votes
0answers
43 views

Passing a complex object across cross domain

I am working with two web applications, one is webform-based Site1 and other is an MVC application Site2. TODO: Pass a complex object from Site1 to Site2. In response get View from Site2 to Site1 ...
3
votes
3answers
162 views

ASP.NET core proper way to work with the repository pattern

I am currently working on my first ASP.NET Core MVC project with a repository pattern. I have gotten it to work but I wonder if there is a better way to solve this. In this case I have an ...
1
vote
1answer
60 views

Update data in partial view

I have partial view which update data on server. Partial view contains list of configurations (can be check box or text box depends on type). This code is working, and I would like to know how to ...
2
votes
0answers
98 views

Mapping Excel columns to table columns, then processing data

I have written some code for mapping excel columns to table columns and processing data after mapping columns. Please review this code, check for SOLID, OOP principles and suggest any improvements and ...
10
votes
1answer
254 views

Unit of Work (UoW) pattern with ADO.NET

I'm trying to implement the UoW pattern using ADO.NET and this is what I've achieved so far: The IUnitOfWork Interface: ...
3
votes
3answers
287 views

Method which handle HttpResposeMessage

I need to create method which handle HttpResposeMessage. Method should throw an exception if error exist, client will handle rest. You can see my code bellow. This code is working fine and doing what ...
3
votes
1answer
95 views

An Edit action in ASP.NET MVC, with handling for missing id parameter

I have a standard Edit action in Asp.Net MVC 5 and I want to avoid throwing the unhandled exception when is made a get request without the id like ~/food/edit, so I did this. ...
3
votes
0answers
89 views

Asp.Net MVC Application Controller

I'm developing a webapp in ASP.Net MVC. One of the requirements of the project is that users follow a "workflow". The workflow has a number of steps, and a conditional branch. The workflow is long ...
2
votes
2answers
72 views

Optimize store proc performance being called in c# on array loop

I have a c# application(mvc) that allows a user to upload an excel sheet containing an account number key and amount value to be passed as parameters to a proc that then validates those records, the ...
4
votes
2answers
67 views

Search for variants of keywords using LINQ

First, I'm adding words entered into a search field to an array. Then, I'm getting results from a stored procedure on SQL Server using Database First approach with Entity Framework. Finally, for ...
1
vote
2answers
102 views

Controller method to update properties of a request

I have a view that displays details of a work order request submitted by a user. As far as security and database querying is concerned, which one of the following options would be better if I'm going ...
5
votes
1answer
53 views

Properly create and customise a web app using visual studio 2015 C# MVC template

I'm new to C# web, I want to know how to properly create a web app using visual studio 2015 MVC templates, and being able to customise some of its code. I want to both practice C# web and clean code.....
3
votes
1answer
104 views

Entity Framework query optimization

A user can track a show, and mark episodes and seasons of that show as watched. To support this I have the models below: Models ...
3
votes
1answer
334 views

Dynamic wrappper used to unit test ASP.NET Core MVC Controllers that return anonymous objects

Originally created for this answer on SO, I thought there was still room for improvement on the initial basic idea. Also thought about using an extension method to make using syntax simpler. Here is ...
4
votes
1answer
219 views

Reading and displaying an image from a folder

I have a question concerning the correctness of the reading and displaying the image in ASP.NET Core MVC web application. This is the way I am reading image names from a specific folder (I am using <...
1
vote
3answers
461 views

ASP.NET Product Listing

I am working on a e-shop in ASP.NET MVC, and I just made the listing of product the way I figured out this night. Is it correct? Or should I make it differently? How? So this is my Product controller,...
10
votes
1answer
126 views

ASP controller for tracking equipment

This was originally posted here. I'm hoping Code Review will be a little more helpful in giving me a concrete direction. I've been working on a project based off of this tutorial. Unfortunately, ...
1
vote
1answer
104 views

ASP.NET C# MVC thin controller for file validation with service layer

My name is Matt and I have a fat controller problem. In truth I have limited experience of MVC and I'm trying to learn how to organise my code better so it's more testable and more maintainable. Here'...
6
votes
2answers
560 views

Expose an IDbSet<> object to overcome a limitation for LINQ's Select()

Before posting this, I have spent the past 4 days tirelessly investigating the Internet and the different Stack Exchange websites on how to correctly implement the Unit of Work pattern and Unit Test ...
1
vote
1answer
25 views

Mapping discussion entries from an SQL-View to objects

In my ASP.NET MVC application, I am loading Discussion Entry records along with User info (who posted the entry), Badges (assigned to the entry), Reactions (made to the entry like Facebook-style ...
0
votes
1answer
64 views

Skip by Id on large list

This is in ASP.NET MVC, but that shouldn't make a difference. I have a large number of rows in my database for Songs. ...
3
votes
0answers
42 views

Multitenant app authorization

Role based security does not work for me well in a multitenant app, as I need to query DB to decide on permission allowance. Here is the solution I came to. All implementations of this interface will ...
1
vote
0answers
62 views

Authentication terminology

Below comes a Value Object to represent UserId in ASP.NET application. It implements Value Identity, so equality is defined by matching of the state calculated at ...
2
votes
1answer
1k views

Custom HttpClient Wrapper

I need to wrap httpClient because I'm using a custom token provider. I will use this code with asp.net mvc to communicate with our webApi2 server. ( Using webApi2 with directly from ui with angularjs ...
2
votes
1answer
52 views

Controller to update a catalogue through an uploaded Excel file

The goal of following MVC controller code is to achieve following workflow: User exports catalog (either with items of type Spread or of type Consumables) to Excel; User makes changes in exported ...
1
vote
0answers
253 views

MVC application internationalization using a database provider and dependency injection

Following Nadeem Afana's article about how to include internationalization into an MVC application, I have introduced i18n into one of my MVC applications. These ...
0
votes
0answers
50 views

Show products in dropdown from parent to chid

My goal is a list selector like this: To do this I wrote these methods: First: ...
2
votes
1answer
116 views

Singleton implementation of Cache Dependency Manager

I am trying to implement a singleton CacheDependencyManager, by combining this CacheDependencyManager from Steve Greatrex with a singleton pattern from Jon Skeet (example 6). I'd really appreciate ...
1
vote
1answer
172 views

MVC API controller processing POST request

Do I need to restructure for readability? ...
4
votes
3answers
114 views

Allowing internal employees to request supplies

Business rules: This application is for internal employees to request supplies. All requests must be approved my the persons manager. In the database, a manager is an employee, with a self ...
5
votes
1answer
119 views

Paginating blog posts from SQL server using nested LINQ statements

I made an ASP.NET MVC application using Entity Framework for code-first migrations to the SQL Server database. I also use Unity (DI/IoC) for managing the services and repositories. I made an overview ...
5
votes
1answer
850 views

Recurring tasks in ASP.NET MVC

I have 2 alternatives for executing recurring tasks in ASP.NET MVC. We just need to add some code in Global.asax First alternative: ...
3
votes
0answers
1k 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
40 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
350 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 feedback....
2
votes
1answer
52 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
84 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 ...
6
votes
1answer
4k 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 ...
8
votes
3answers
583 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 ...
8
votes
1answer
10k 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
219 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 ...
4
votes
2answers
156 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 ...
2
votes
1answer
149 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
311 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
74 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
851 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
2k 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, ...
0
votes
1answer
121 views

Copying properties between two classes

I have an ASP.NET MVC 5 app and I map properties between model and viewmodel and vice versa. I could use automapper to do this but since I don't need mapping rules to convince me to use it as I ...