Questions tagged [asp.net-mvc]
Model-View-Controller for the ASP.NET framework
237
questions
2
votes
1
answer
207
views
Dynamically MVC controls
I am working project where I need to build ASP.net control based on JSON data. I am using the method below GetMeetingPollingQuestion to create this model.
Any suggestions/comments are greatly ...
2
votes
1
answer
224
views
Building ASP.Net control from JSON Data
I am working project where I need to build ASP.net control base on JSON data. I am using this method below to get all the data into class. I as using FirstOrDefault ...
1
vote
1
answer
89
views
Display a table with exchange rate data
I have created a code that displays a table with exchange rate data. Have I used loops and conditions (if else) in a good way?
...
0
votes
0
answers
184
views
BaseController with Generic Entity and Model
I created a controller with generic TEntity and TModel so that i will not have to repeat common actions like save/delete for each entity. I just want to ask if this is a good or a bad practice?
...
2
votes
2
answers
725
views
ASP.NET Web API for currency
On the basis of the daily exchange rate data of the CB (https://ww.cbr-xml-daily.ru/daily_json.js) it is necessary to create a Web-service using ASP.Net Core, which implements 2 API methods:
...
1
vote
1
answer
73
views
Best approach to combine repositories logic
Let's suppose I have 2 repositories:
first is responsible for creating job and return jobId
second is responsible for creating ...
1
vote
1
answer
55
views
JsonResult Building menu
This logic checks different method and adds links to response that is returned to a view. I there a better way to do this ?
...
0
votes
2
answers
363
views
Strategy Design Pattern in ASP.Net Core MVC Project
I tried to make a calculator using the Strategy pattern in ASP.Net Core MVC (following an example from the Internet)
Please review my code and tell me what could be wrong and how to make it better?
My ...
1
vote
1
answer
2k
views
Detecting supported browsers in ASP.NET MVC (Server side vs. Client side)
I want to check client's browser version, and if it's too old, display a message that the user should update their browser in order to use the website. The website is built using ASP.NET MVC.
I have ...
1
vote
0
answers
58
views
Credit based order system
I'm implementing a system, which requires an order to be active.
I have a class called Yritys, which is the customer account who would have credits.
1 credit would mean 1 day of service use.
Yritys (...
0
votes
1
answer
68
views
Use Request with Fileupload in Controller
I wrote a fileupload function for my application. Basically the application is a web based folder structure, which has files included.
I don't know, but I am not happy with it. Is it too long? Can I ...
0
votes
1
answer
6k
views
Generic Wrapper class for HTTPClient methods
I am trying to using HttpClient for making API calls from a different domain and for that purpose I have created the following service class after doing some research. It is 4.7.2 framework and not a ....
4
votes
2
answers
3k
views
Repository pattern with Unit of work using ADO.NET in C# to authenticate user from database
So I am using the latest version of Dapper and it works great for mapping my POCO classes but there are some scenarios where I need to return a DataSet instead of ...
2
votes
0
answers
61
views
Managing invalid cookie when 2 users use the same computer and therefore share the same cookie
I have asked this question on stackoverflow... here, I am asking for some feedback on the solution that I have implemented.
I am using ASP.NET MVC default template to logout user:
...
3
votes
2
answers
2k
views
c# IEnumerable Update object
I have this code that I am using to update OriginalId using the Id value. I there a better way to do this then using all the loops?
Controller
...
1
vote
1
answer
88
views
Decoupling of validation and data access in ASP.NET
I've been asigned to a project no dev has touched in a long time. It's an ASP.NET MVC 4 application.
It appeared to be well coded, but had no testing and the database migration folder is not present.
...
9
votes
3
answers
814
views
Creating a round robin MySQL connection manager
Background
I am working on an e-commerce website, my web server is written in ASP.NET MVC (C#, EF6) and I am using 3 instances of MySQL DB. These DBs are in a cluster (Galera Cluster) and they are ...
0
votes
1
answer
77
views
Calculate 8 hours business day in a weekdays only [closed]
I am fairly new into asp.net MVC c# I am working on request holiday app where an employee can request holidays. The problem is the app works fine, however, I am trying to set 8 hours a day when an ...
3
votes
1
answer
194
views
Grouping low-level services together into a high-level service
I am working on an e-commerce website. What I need to do is to save an advertisement. The ad has some properties and some photos... properties should be save to DB and photos should be saved to file ...
1
vote
1
answer
1k
views
Filtering items in an ecommerce site with asp.net mvc and ajax
I'm trying to filter items from an ecommerce site.The project on the local server was running smoothly.However, I noticed significant delays since the project was published on the global server.Most ...
1
vote
1
answer
66
views
Using nullable properties in a base class for record selection in Table per Hierarchy
I want to be able to list every Transaction associated with a Client in date order.
...
1
vote
1
answer
148
views
ASP.NET MVC 5, EF 6 filter performance
I'm creating a filter with Linq in an ASP.NET MVC application. I was hoping I could get some tips on performance enhancements, aside from any possible performance enhancements.
I have a few questions:...
8
votes
4
answers
4k
views
DDD Architecture for an e-commerce website (uploading images)
Problem Description
I am working on an e-commerce website, when a user wants to sell a product, he would open the product page and he can upload up to 12 photos:
Image Upload Process
This is the ...
1
vote
1
answer
1k
views
Creating a ModelBinder to Sanitize user input in HTML format
I have a custom model binder which takes user input in HTML format, sanitize the HTML input by removing any script or XSS threat and returns the sanitized HTML string:
...
3
votes
1
answer
2k
views
Use SemaphoreSlim to control access to a resource
We have an existing situation in an MVC ASP.NET app where it's possible for two threads to come back asynchronously, one from an external api(the payment gateway) and one from within the browser for ...
4
votes
1
answer
802
views
Initializing entity framework context in constructor
We use the architecture shown in the code below to initialize the DB context for our MVC 5 project using entity framework 6
We have the following questions related to it:
Is it safe to initialize ...
1
vote
1
answer
157
views
Authorization using Entity Framework in ASP.NET MVC
1. Backstory
I recently starting programming and I found out that Entity Framework works perfect for my small-sized applications due its simplicity.
I've made my custom authorize attribute for MVC ...
1
vote
0
answers
162
views
Add a folder with jstree
I read on SO and other pages that I should avoid JavascriptResult, I do not realy know why, but now I use JsonResult, because it is more common.
Here is my Ajax in the cshtml:
...
3
votes
0
answers
2k
views
Controller in an ASP.NET Web API application which generates a CSV file
I have a controller in an ASP.NET Web API application which generates a CSV file. The controller looks like this:
...
3
votes
0
answers
2k
views
AJAX shopping cart with quantity +/- buttons
I'm a junior developer (couple years into it) and very new to AJAX.
I'm writing an internal inventory application built on MVC and right now I'm dealing with adding and removing items to/from a cart. ...
1
vote
1
answer
77
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 ...
0
votes
1
answer
2k
views
Upsert with .Net Core Web API
I am using .NET Core 2.2, EF Core and C#. I have created a web API project.
I was requested to do an Upsert (insert or update). The entities structure is:
Movie
User
Rating: this is used to give a ...
0
votes
2
answers
84
views
Authorization - Create and unlock a User
I just wrote this, but I am not realy happy with that. I think there is an easier way to do this. First I am checking if a user has an ID (from a portal we are using, it is in the header). After that ...
3
votes
1
answer
157
views
Instantiating View Models using a static factory
I am building an e-commerce website. I have an application layer service called SearchService. SearchService receives a search ...
0
votes
1
answer
118
views
Rendering an html page uploaded by a user into MVC app
I need advise whether the approach I took is the optimal one (not sure whether this is the right 'stackExchange' site).
I have an MVC application, which is supposed to be able to render an HTML page ...
1
vote
0
answers
237
views
E-commerce site for posting advertisements
I am developing an e-commerce website in ASP.NET MVC. Users can post advertisements of different types on the site.
I am using inheritance to define my Ad types, and this review is mainly about ...
1
vote
1
answer
125
views
Wrapper for a sales API, with a fluent interface
I've created a simple API wrapper that I intend a few developers to utilize. I decided to follow an Fluent Interface methodology, similar to this.
...
2
votes
1
answer
586
views
Displaying all application errors in a view
I'm learning ASP.NET Core with MVC pattern and I didn't find anything useful related to this argument.
Actually I'm looking ...
4
votes
1
answer
2k
views
Generating absolute URIs behind a reverse proxy
In my ASP.NET MVC application there are occasions where I need to generate an absolute URI, such as when sending an email confirmation link to a user. The most straightforward approach is to use ...
2
votes
1
answer
313
views
Design Pattern for initializing Properties of a ViewModel which only serves a display purpose
It's a question which lies me for years on the tongue.
Given a LoginViewModel:
...
0
votes
2
answers
12k
views
Return json to browser via MVC controller for morris chart
Program is written in .Net Framework 4.
Class:
...
3
votes
1
answer
2k
views
Dynamic AuthorizeAttribute with database
I want to create a AuthorizeAttribute that gets the current ActionMethod RouteData and ...
10
votes
1
answer
552
views
Checkers Board Creator
A year or so ago, I wrote a checkers game for the Universal Windows Platform. Now, I wrote a web-based version of it hosted at http://checkerstreasury.azurewebsites.net. This is the first of a series ...
2
votes
1
answer
4k
views
Adding or updating Company entity
Here I am trying to post a company view-model and update and insert according. But I feel I am writing it in wrong way or maybe there's a better approach.
Here's my code
...
1
vote
3
answers
6k
views
Sending many unique emails at same time
I have an asp.net core app that sends emails with a link. When they click the link they can start taking an online test without logging in. The link contains a number that is validated by the ...
2
votes
1
answer
1k
views
Web Service that gets data from multiple tables in a database using EF Core Database-First approach
I have never created a web service before. I followed most of this Pluralsight tutorial to give me an idea of how to create one using ASP.NET MVC along with .NET Core 2.0 and Entity Framework Core.
...
1
vote
1
answer
1k
views
Configuring certificate signing for development and production environments
The below code works but there's a lot of duplication I wonder if I can get around.
I would like to be able to use .AddDeveloperSigningCredential(false) if in ...
2
votes
1
answer
4k
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 ...
5
votes
1
answer
5k
views
ASP.NET Core 2 architecture and design patterns
I started a week ago to split my project into layers: business logic layer, data access layer and UI layer. I took as an example this project: https://github.com/dotnet-architecture/eShopOnWeb. I ...
4
votes
3
answers
494
views
Caching an integer - distinguishing no value from zero
I would like to store an integer value in the application cache.
The GetOrSet method should always return an int, and never be null. If there is no cached value, ...