Questions tagged [asp.net-mvc]

Model-View-Controller for the ASP.NET framework

Filter by
Sorted by
Tagged with
1
vote
1answer
49 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
3answers
389 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
1answer
39 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
1answer
164 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
1answer
76 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
1answer
45 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
0answers
55 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
1answer
70 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
4answers
697 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
1answer
84 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
1answer
158 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
1answer
167 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
1answer
65 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
0answers
33 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
0answers
41 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
0answers
715 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
0answers
308 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
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 ...
0
votes
0answers
554 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
2answers
78 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
1answer
113 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
1answer
79 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
0answers
207 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
1answer
93 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
1answer
238 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
1answer
1k 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
1answer
152 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
2answers
11k views

Return json to browser via MVC controller for morris chart

Program is written in .Net Framework 4. Class: ...
3
votes
1answer
868 views

Dynamic AuthorizeAttribute with database

I want to create a AuthorizeAttribute that gets the current ActionMethod RouteData and ...
10
votes
1answer
299 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
1answer
3k 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
3answers
4k 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
1answer
786 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
1answer
586 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
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 ...
5
votes
1answer
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
3answers
223 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, ...
5
votes
1answer
2k views

Extending IPrincipal.IsInRole()

In my case, I needed to give roles to users, but to specific departments, and I did not want to implement a new authorization mechanism which will require me to access the db everytime I want to check ...
1
vote
1answer
93 views

Display items from DB using MVC and Domain Driven Design

I am starting a project to put into practice the lessons learned in "Clean Code" by Robert "Uncle Bob" Martin. The project is a website that displays the names of items in a DB table. It uses ASP.NET ...
3
votes
4answers
2k views

Find consecutive numbers and turn them into ranges

I have array int[] arr = { -2, 0, 1, 2, 3, 4, 5, 8, 9, 11, 13, 15, 18, 22, 25, 28, 29, 30 }; I need to write function that shows it as string and if numbers are ...
2
votes
1answer
76 views

IsDatabaseUp returns true or throws exception

I want to write an ASP.NET Web API endpoint that allows clients to check if database is running. The method below is check if database is up by establishing a connection and running a dummy sql ...
2
votes
2answers
279 views

EventLogger for MVC application

I have worked on one application related for booking space and required to store activity of user into table and access from admin side. For that I have created one database entity and ...
2
votes
1answer
144 views

Apply Coupon Validation in Order

I have created a mvc application for booking space. In this for booking user can applied coupon for booking. I have implemented one coupon service and validate coupon. ...
0
votes
2answers
318 views

Common Implementation for Sending mail based on time

I have created one Background service that execute after every 5 minutes and this service used for sending email after 6 hour,24 hour and 48 hour for user booking order is not confirmed. for that i ...
1
vote
1answer
1k views

HttpClient wrapper for simple calls with optional cert

Trying to ensure each controller contains it's own httpclient. The super user can change which endpoint is called from the site and some of those endpoints do not require a certificate, but some ...
7
votes
3answers
2k views

CQS implementation with decorators

I've created a "framework" or more of a library for a CQS implementation with a few decorators. Using ASP.NET Core for the front end, I wanted an opinion about how this looks/feels. I changed the ...
1
vote
0answers
43 views

Querying a database to find notifications to comments

I have a solution what I think is not the best, and I want to make this not so expensive. I'm using MVC 5 + SignalR (hubs) + EF + UnitOfWork + Generic Repos. I have a table ...
2
votes
0answers
532 views

RESTful API combining three other APIs

I have created a RESTful API that uses three other APIs with Visual Studio 2017 in .NET Core. It is the first time I have ever programmed in .NET so I am sure the code could use a lot of improvements. ...
2
votes
2answers
3k views

Separating paging, sorting and filtering

in my ASP.NET MVC application I have a service that had a method for paging, sorting and filtering of Vehicle Makes: ...
1
vote
1answer
353 views

Calculating difference in time

In table first value I have value with datatype = Start I need to calculate difference first value - midnight Last value is ...

1
2 3 4 5