Questions tagged [asp.net-mvc]
Model-View-Controller for the ASP.NET framework
244
questions
2
votes
1
answer
51
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:
...
0
votes
0
answers
81
views
.Net Request ServerVariables
In my controller I have this model which has IPaddress. I created this method GetUserIP taking in the HttpRequestBase request ...
0
votes
0
answers
61
views
ISO Xml Serializer for .Net API Controller
I've created a pretty simple XML input formatter, that inherits from XmlSerializerInputFormatter, that is able to serialize XML input that is ISO-8859-1 encoded.
I created it, so that I do not have to ...
1
vote
1
answer
61
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
50
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 ?
...
1
vote
2
answers
168
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
334
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
56
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
45
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
1k
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
1k
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 ...
1
vote
0
answers
47
views
Addition/removal of entities in EF6 many-to-many architecture
Is there a way to do this many-to-many update with less code? It feels awfully bulky to me.
I started out using AutoMapper to avoid the explicit value assignments, but then the mapped ...
2
votes
0
answers
58
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
1k
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
62
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
635
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
50
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
180
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
810
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
52
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
0
answers
88
views
Getting around CORS error for displaying images on my website
I have my images stored in an S3 bucket and I am serving them from AWS CloudFront. I have created 2 CNAME records for the CloudFront: mywebsite.com and ...
1
vote
1
answer
119
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
3k
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
583
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
996
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
490
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
134
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
43
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:
...
1
vote
0
answers
53
views
Querying connection string across solution [closed]
I have an app.config file that contains some connection strings, this is accessed on a project-by-project basis
In my solution, I have the following projects:
A
B
...
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
1k
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
58
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
1k
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
79
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
142
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
84
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
224
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
111
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
531
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
213
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
426
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
5k
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 ...