Questions tagged [asp.net-mvc-5]

ASP.NET MVC 5 is the fifth major version of the ASP.NET Model-View-Controller platform for web applications.

Filter by
Sorted by
Tagged with
0
votes
0answers
118 views

Chart.js - Getting data from database using sql server and asp.net mvc5

I displayed and styled the chart.js and am also using mock data in the array, I just can't get my head around how to populate the data in the chart.js using MVC 5. I have tried lots of different ...
3
votes
1answer
75 views

Caching lookup values in an e-commerce website

I am working on an e-commerce website. I have a CarMake dropdown which contains car make names and their corresponding Id, for example: { 1:Alfa romeo}, { 2:Audi }, ...
1
vote
0answers
55 views

Bookmark controller with IMemoryCache

I'm just doing a small hobby project to solve a little problem I have and I'm using it as a learning exercise for ASP.Net MVC 5, .Net Core 2 and Bootstrap. I'm using a nuget package that handles ...
1
vote
1answer
54 views

ASP.net service that sends email whenever an entity is updated [closed]

I have an ASP.net MVC5 project which involve different domain services, and one of it are EmailService which will send email if entity is updated. ...
1
vote
1answer
48 views

Making EmployeeHistory ViewModel immutable as code analysis suggested

I want to display on a view the EmployeeHistory view model sorted by elements.assignEffDateNext and I want to instantiate and ...
5
votes
1answer
64 views

Display all files in a folder (object) along with nested subdirectories part 2

Previous post: Display all files in a folder (object) along with nested subdirectories Task: Given a main directory/folder, list all the files from it and if this directory contains nested sub-...
4
votes
1answer
180 views

Display all files in a folder (object) along with nested subdirectories

Follow-up question: Display all files in a folder (object) along with nested subdirectories part 2 Task: Given a main directory/folder, list all the files from it and if this directory have other ...
2
votes
0answers
229 views

Handler for jQuery DataTable search with filters and pagination

This AjaxCompound is invoked every time when the user types a key for search or click to sort. It contains 1million data 10 distinct rows by compound name. It takes 1.1 minutes and return only 1-5 KB ...
1
vote
1answer
857 views

ASP.NET Identity 2.0 UserManager alongside with UnitOfWork and Service-Locator anti-pattern

I was wondering whether it is a good aproach to have Identity 2.0 UserManager next to UnitOfWork pattern? I am using ...
2
votes
0answers
3k views

Member management of Active Directory groups via an ASP.NET MVC website

Background One of the projects I'm working on is an Intranet website which is a front-end for several kinds of data, each aimed at a different set of users. Access to the website is handled through ...
4
votes
1answer
572 views

Multilingual website with a database

I created a multilingual site in MVC and I reached the current results, but I'm not sure it's the right way. I have created a class named changeLanguage to change ...
0
votes
1answer
847 views

Entity Framework MVC updating db using a repository method [closed]

I have inherited this code from a legacy project, and it is throwing a New transaction is not allowed because there are other threads running in the session. error. Now I know the problem here is ...
2
votes
1answer
327 views

Creating a simple unit of work with Entity Framework and no repository

I've been trying to implement a .NET MVC Unit of Work API (rather than creating a separate repository), but it doesn't feel right. Am I going about this the correct way? Following advice from here. ...
1
vote
0answers
669 views

C# MVC Generic Custom Model Binder

I recently created a custom model binder as a training exercise and wanted to see how I could improve it. It currently uses recursion and works great, but I was wondering how I could convert this to ...
4
votes
2answers
7k views

Handing “Others” option in dropdown in ASP.Net MVC 5

Business Logic I have a company referral form, and in that form I have dropdown to select from a company list. But when a company is not found in the dropdown, the user can select option as "others", ...
3
votes
1answer
11k views

Display a dropdown based on another dropdown change

I have a dropdown and when that dropdown changes I want to display/render another dropdown. Can someone help me improve it? So, a person requests for getting referred in a company for a job. When ...
4
votes
1answer
1k views

Refactoring ViewModel and mapping from multiple sources

I need to refactor and tidy the following controller below, it's my first MVC application. I've successfully used AutoMapper as I began refactor controllers but I am not sure how to approach a ...
6
votes
2answers
6k views

“Forgot password” functionality

I want to implement the "forgot password" functionality in Asp.Net MVC 5. Here is the code flow: Take user email ID Let the user enter the token received in his email inbox If the token matches then ...
2
votes
0answers
234 views

Navigation Menu Code went from mvc controller into the view model

Sometimes code seems to write itself (kinda like a donut seems to eat itself) and that happened in this case, but I have thought that UI view models (MVC models folder) were supposed to be stupid to ...
1
vote
0answers
917 views

.NET MVC Infinite Child record add

Here is my working attempt to allow multiple/infinite child record entries with the original parent post in .NET MVC. Any refactoring to simplify my code would be greatly appreciated: Controller: <...
1
vote
2answers
106 views

Good Unit Tests when ReSharper bugs for null checks

I have the latest version of ReSharper installed and I am trying to write a Unit Test for my MVC controller. I need the Unit Test to: Ensure the ViewModel passed to the View is of the correct type. ...
2
votes
1answer
59 views

Website to Track Project's Progress

This ASP.NET MVC website is for my professor to track my progress on my Checkers app. This is the first time I have build an ASP.NET website entirely on my own, and I would like a review to make sure ...
3
votes
2answers
3k views

Scraping HTML via async controller & classes + HTML agility pack

I've developed a simple application to grab golfer index scores from a website that has no API. The application works but is very slow, with 6 users that require updating takes 60 seconds. I've tried ...
2
votes
1answer
2k views

Logging requests on a separate thread

I have an ASP.NET MVC 5 application that needs to log to the database every request for a specific controller action and every link click that happens on the view of that action. Since the user ...
3
votes
1answer
759 views

ASP.NET MVC - server-side Ajax result conversion

I am currently in the process of creating a website which requires it to work with and without JavaScript enabled. All callbacks to the server with JavaScript enabled will be made through Ajax ...
3
votes
1answer
1k 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. ...
-2
votes
1answer
276 views

Data paging for a forum website in Asp.Net MVC [closed]

I've struggled with this for quite some time. Today I finally wrote the following code. The ViewModel contains an int property which later tells the view how many ...
5
votes
1answer
12k views

Ensuring specific columns in an ExcelWorksheet format as ShortDate

For a while, I have worked with the Nuget Epplus package to export MVC models to fresh Excel documents. While the code I show below works correctly, I have a feeling that either I can make this code ...
7
votes
1answer
8k views

Using Identity to create user administration page

I'm developing an ASP.Net web application, using MVC 5. This application authenticates via LDAP and will assign an Identity Role of "Admin" to a designated user. The Admin user will be able to go to ...
2
votes
2answers
16k views

Calling Web API from MVC generic way of approach

Our Project architecture is AngularJS + MVC + WebAPI. Angular JS would call MVC action and MVC action further calls API methods. Below are some of the action methods we used for calling api methods. ...
2
votes
2answers
614 views

ASP.NET WebAPI `In` Validation Attribute

I've created custom validation attribute that will be used to validate model. It allows me to specify values that are valid for specific field. Here is my code: ...
7
votes
2answers
10k views

Get host ip address behind load balancer or without lb

Description Aplication type: WEB API .NET Framework: 4.5 MVC: 5 I need caller host ip in my custom action filter and then in action. On some enviroments we have configured load balancer which ...
3
votes
1answer
5k views

Login system using a persistent cookie

I want to be sure that my code below properly secures the website based on all of the information provided. Login System Overview When a user logs in, the following user info is saved to a ...
1
vote
1answer
406 views

Refining an ASP.Net MVC VeiwModel for a Table to display worked hours

I am writing an ASP.Net MVC app which has a page that will display a standard table which will contain a person's hours for the week. The basic structure of the table would be a 7 column, muti-row ...
1
vote
1answer
906 views

Bundling JavaScript resources for an MVC app

This is my first MVC app. I'm looking for best practice feedback on how to best bundle the files that I need, the order to bundle them, the placement of the @render ...
3
votes
0answers
668 views

AngularJS client side logging in a MVC web application

Being a newbie into AngularJS, I have overlooked the importance of client side logging until some non-reproducible client-side errors occurred and I realized that they were not logged. My web ...
3
votes
1answer
2k views

Create “refresh token” action filter

I am using idenity server 3 authentication. I have to implement refresh token logic. AccessTokenLifetime is 1 hour, and after that time I want to update access token with refresh token. I want do ...
3
votes
2answers
170 views

Using viewmodel create comper and edit

I have this really long httppost action results that I add and update 3 db tables I think it's too long and can get shorter and smarter. ...
4
votes
1answer
106 views

Joining tables with EF

Here is my database: Here is my viewModel: ...
5
votes
2answers
193 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 ...
8
votes
2answers
232 views

Saving data in MVC

We have a lot of Controller ActionResults like this in our MVC project. The controllers get really cluttered up. This is a simple example, but we have much more ...
5
votes
2answers
12k views

Clean call api from client, with good practice

I am working on architecture where I can have any client + server API. I need to call API as clean as possible and get, post, put any object I want to. For me, it is important to have clean secure ...
1
vote
0answers
757 views

Securing User Credentials in Cookies

I have an asp.net/MVC5 app that for reasons that are outside of my control needs to hang onto (some) user credentials (username and password) to facilitate certain operations they may perform. I don't ...
1
vote
1answer
994 views

Using custom negotiator and custom formatter in Web API 2

Here's my custom formatter which I want to use for "application/x.product" content type: ...
0
votes
1answer
315 views

MVC.Net View Model

I'm nearing the end of my first MVC project which uses VB.Net and MVC5. I've started writing all my view models in a very similar fashion. This has been working well for me, but being the first ...
3
votes
1answer
371 views

Configuring MVC 5 project with service layer and DI and UOW

In the past I have always called the repositories directly from the controller, but that is a bad practice and now I am implementing a "Business Layer" to my project. Would I have two UnitOfWorks? ...
1
vote
1answer
666 views

Formatting MVC 5 Razor link as a string

MVC 5 doesn't seem to like JavaScript that much. I am creating link in JavaScript to a success method in my Ajax call. Razor: ...
5
votes
1answer
508 views

Redirecting a user

When the user clicks the first button ('Back to List' button), I redirect the user to the Employee List page. Can you please review this and suggest if there is any better way of achieving the same? <...
5
votes
2answers
487 views

Support ticket application: ticket listing index with sorting and filtering

I am new to ASP.NET (C#) and MVC 5. I'm really enjoying it so far, but want to take a step back and make sure that I'm following best practices here. My controller seems like it may be getting too fat,...
6
votes
1answer
69 views

Searching school data

I am running a test load using Telerik Test Studio using 100 users at once entering search filters on a page that calls a stored procedure. My application that calls the stored procedure is an ASP....