Questions tagged [asp.net-mvc]

The ASP.NET MVC Framework is a Microsoft web application framework that implements the model-view-controller (MVC) pattern.

Filter by
Sorted by
Tagged with
0 votes
2 answers
329 views

Mediator Pattern in c# - using a mediator to trigger policies

I'm wondering how i can implement what Im calling "business policies" in my code? For discussion purposes, let's say I have two separate contexts - synchronizeUsers and Licensing. The ...
dot's user avatar
  • 531
-3 votes
2 answers
998 views

Chose between .net 4.8.1 and .net core 6.0 . is the support life cycle an important factor to consider

I want to start developing a long-life ERP system to a customer. now on paper I would chose to develop it using .NET core 6.0 with SQL Server. But one of the main drawbacks which the customer did not ...
microsoftdeveloperdesigner's user avatar
1 vote
0 answers
65 views

ASP.NET MVC use ViewModels with Services

I'm trying to make a simple Blog-application, but I'm a bit stuck on the architecture of the application. I'd like to create a details-page with the content of the blog-post and a form for adding ...
Sam's user avatar
  • 55
-1 votes
1 answer
1k views

How are parameters values passed into a MVC controller constructor?

For this MS sample code, I have checked Program.cs, Startup.cs, and other config files, don't see how the two parameters sqlQueryService and sqlCommandService are populated. Appreciate if someone can ...
Jeb50's user avatar
  • 101
1 vote
1 answer
945 views

Mapping between Entity and ViewModel

I'm trying to make an application in ASP.NET MVC. I'm using AutoMapper for the conversion between entities and ViewModels. In most cases, this works fine, but when I need to add some additional data (...
Sam's user avatar
  • 55
0 votes
2 answers
397 views

Best practice ASP.NET MVC share code with Web API

I'm trying to develop an ASP.NET MVC-application with an additional Web API. To reduce code-duplication, I'd like to share as much code as possible, but with the possibility to differentiate between ...
Sam's user avatar
  • 55
5 votes
2 answers
913 views

Best way to refactor service with too many dependencies

We are creating the backend for a web app using a sort of layered architecture. The service layer is supposed to handle the business logic and passing data to the repositories. This service layer is ...
zamsler's user avatar
  • 59
2 votes
1 answer
480 views

In an MVC Application, What Goes Where?

In an Model-View-Controller (MVC) design pattern, What goes where? What code goes to model and to controller? I know (do I?) that business logic should be define in a model, but a lot of example I ...
careLess's user avatar
-1 votes
1 answer
46 views

Looking for way to store, get, partially update few relatively small JSON documents which has different unique types

I have an app with many individualistic features which behavior is controlled by settings. Let's say these are a few utility services with the following settings that are historically stored in ...
valterriann's user avatar
1 vote
1 answer
2k views

How to unit test public method which internally calls many internal or private methods which are already individually unit tested [duplicate]

In our ASP.NET Core application, we have many APIs which are calling public method from the service class. Service class is implementing an Interface. Each service method (depending upon complexity ...
WAQ's user avatar
  • 113
3 votes
2 answers
1k views

Why do backend web frameworks use "MVC" when they have no persistent UI to update?

Model View Controller (MVC) is focussed on UI based applications. In MVC the model notifies the UI (view) when its values change and the view then decides what and if to update. I can understand this ...
Eoin's user avatar
  • 309
0 votes
1 answer
161 views

Monolithic view model MVC

Currently working on a legacy app. One section deals with generating "reports", each which share some common subsections, that are based on strongly-typed razor partial views. The largest ...
Lovethenakedgun's user avatar
1 vote
3 answers
350 views

Is creating an entity in a database considered to be business logic?

According to my (perhaps incorrect) understanding business logic includes saving/updating entities in the database, as well as connecting with any 3rd party API's or using services and should ...
Yos's user avatar
  • 155
0 votes
1 answer
1k views

Right way of folder structure in MVC Project

I'm building a project with C# AspNet.Mvc. I'm using Entity Framework Core. It has Poco which maps in data from DB. On Mvc project itself i've got ViewModels folder where i have models topass between ...
Mattew's user avatar
  • 9
-1 votes
1 answer
54 views

Checking caller has access to an API resource - Design

We have a managers api (/api/managers/-/staff), which will get a list of staff that the currently logged in manager has been granted access to. It is the Managers service. We also have a staff api (...
Pat Long - Munkii Yebee's user avatar
5 votes
1 answer
3k views

Moving shared CQRS/Mediatr Request Handler logic into services and avoiding code/logic duplicity?

We recently embraced Clean Architecture and CQRS, by way of Mediatr, in several of our new applications. A similar (SPA-based) demo can be seen here. For many of our WebApi-based projects, this worked ...
JD Davis's user avatar
  • 1,367
2 votes
3 answers
541 views

Is this approach with JWT tokens wrong?

I have .NET Core WebApi application with JWT token for authorization. I also have roles and permissions. To make it more flexible for end user, I decided to make permissions like this: [Authorize(...
Jamil's user avatar
  • 131
1 vote
2 answers
7k views

How to retrieve a device information (e.g. device name) via web page

What we want to do is very simple We have a check-in kiosk website (C# ASP.NET MVC), and we are trying to set up 30 kiosk stations at each building (each building is about 200 ft away from each other)....
kabichan's user avatar
  • 113
0 votes
0 answers
59 views

Integrating Blazor Client side into an ASP.Net MVC Core 3.1 app. Is it logical or am I better off building new Blazor app from scratch?

I am in the middle of a project building an internal admin web site using Asp.Net MVC Core 3.1 Some of the features I need in the app could benefit from Blazor Client side. (Single Page App features?)...
John S's user avatar
  • 201
6 votes
3 answers
11k views

Is unit of work pattern really needed with repository pattern

I am trying to use EF6 with my project. I just watched Repository Pattern with C# and Entity Framework, Done Right | Mosh video. I understand the necessity of Repositories but I still don't understand ...
Mansur's user avatar
  • 263
0 votes
1 answer
2k views

Is it good practice to save an entire ViewModel in Session (C# ASP.NET MVC)

I have an C# MVC Application which is basically a large application form. We are using a large ViewModel to store all the information the user enters as they pass through multiple steps in the ...
TroySteven's user avatar
-1 votes
3 answers
529 views

Using a separate desktop application for handing scheduled tasks in an ASP.NET MVC Application

I have an ASP.NET MVC application and I will need to execute a task every one minute. The task is: -> Go to database -> Check from Table 1 if a record has value = "something" -&...
knewit's user avatar
  • 17
0 votes
3 answers
5k views

ASP.NET MVC - Using Session Variables or Caching to prevent unnecessary calls. Is it a good practice in general?

I have an application that consists of multiple sections of which each section will need to load data from various API calls. Now I'm thinking of taking advantage of Session variables(or caching) to ...
knewit's user avatar
  • 17
-1 votes
1 answer
184 views

How shall I implement a MVC program into presentation, business logic and data access layers?

Here is part of an ASP.NET MVC program, from https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/controller-methods-views?view=aspnetcore-3.1 : A model class Movie: public class ...
Tim's user avatar
  • 5,415
0 votes
2 answers
59 views

where to put presentation data formatting method

I am trying to display a specially formatted dropdown list as part of a view. I have a controller action which fetches the data for the dropdown, then needs to format it by fetching certain other ...
Riz's user avatar
  • 196
1 vote
1 answer
648 views

Does Asp.Net Identity worth the overhead?

I'm creating web applications using Asp.Net Core Identity with N-Tier architecture. Lately I've been discovering many properties of this library that I didn't know before as I need to configure the ...
brainoverflow98's user avatar
0 votes
1 answer
247 views

Using WebAPI as infrastructure layer in ASP.NET MVC

I'm starting a new asp.net mvc core project and for my infrastructure layer I'd like to use WebAPI as this layer should be usable in other solutions besides this one. I'm not really experienced with ...
Deadzone's user avatar
  • 111
0 votes
0 answers
272 views

Is it the right pattern for Razor Pages' private methods to return IActionResult to handler?

Is this a good code pattern in ASP.NET Core Razor Pages, for private methods to return IActionResult to the calling handler? // Public handler public IActionResult OnGet() { var result = ...
Nick's user avatar
  • 109
1 vote
2 answers
312 views

Class property re-use vs redundancy

TL;DR - When designing classes for MVC use, is there "best practice" for how classes should be structured to eliminate property duplication and/or redundancy? I'm trying to avoid large (one-size-fits-...
EvilDr's user avatar
  • 117
-2 votes
1 answer
557 views

MVC Routing (attribute routing) and project structure

how would i organize my project structure, areas or folders to support logical grouping structure within my project. www.mysite.com/org/{dynamic}/Importer/{controller}/{action} Currently i have two ...
Seabizkit's user avatar
  • 113
4 votes
2 answers
824 views

Multiple Applications, how to bring them together?

I have 7 different .NET Core applications (solutions). All supporting a different workflow such as customer request, request for change and much more. However, they do share a similar goal (that is to ...
ImFluffy's user avatar
1 vote
1 answer
107 views

Best practice for multi-application communication and events?

Essentially, I have a web application and a console application. The web application allows users to configure what will be processed, which is just a big information processor. From the web UI, a ...
Dortimer's user avatar
  • 127
0 votes
0 answers
260 views

DDD with web api, how to correctly display error messages that caused by domain to the client?

I asked a question about duplicate validation in domain or application layer. Now, I decided to put all the business rules in the domain layer. I have a value object like this, it has a method for ...
Libron's user avatar
  • 61
5 votes
1 answer
3k views

DDD with web api, validation in domain or application layer?

I saw a lot of discussion, but I don't know how to do it in a real world. I understand that validation duplication in the client and server is needed. But how to elegantly validate in server and ...
Libron's user avatar
  • 61
2 votes
2 answers
816 views

What do I misunderstand about the mediator pattern?

I decided to use Mediator Pattern (with Mediatr) to call my application layer. It's cool and I got how to work with it sometimes, but sometimes I get confused. For example, when we publish a document ...
Leandro De Mello Fagundes's user avatar
1 vote
2 answers
314 views

Downloading and appending data from AWS S3 whilst avoiding clashes

I have to upload a TSV file to an S3 bucket, the content is form submission data. Another service will consume and do things with this data as soon as possible. The service would like one large file ...
monkeySeeMonkeyDo's user avatar
6 votes
5 answers
3k views

Is it valid to let view models populate their own lists for dropdowns in mvc?

I've struggled to find any discussion on this. If you have a simple MVC page for updating a User, and you put a dropdown list on it of Country, you need to populate the dropdown list in the viewmodel....
NibblyPig's user avatar
  • 3,005
0 votes
1 answer
1k views

Where to store calculated values of an entity

Trying to figure out the best place to store calculated properties related to a base entity class for use through out the application, namely in view models and DTOs. For example, a base entity class ...
crichavin's user avatar
  • 135
0 votes
2 answers
340 views

Building Client Specific Application on Top of Standard Application

I have a standard application and in this case, it is an Accounting ASP Net MVC application. Now, I have a new client that has their own specific requirements like other fields and some custom ...
Lawrence's user avatar
  • 123
1 vote
1 answer
2k views

Simple Audit Logging Design

I have a C# MVC application. One of the requirements of the application is to maintain an audit log of everything that happens to a particular 'entity' page. To make the example concrete, lets say ...
Iofacture's user avatar
  • 113
0 votes
1 answer
176 views

Authorization & Profiles considerations for ASP.NET MVC Customer Portal

there's an up and running self-serve customer portal built that I'm trying to make a bit better when it comes to displaying proper items for different client types and auto-logging users. Here are a ...
Daniel Tsvetkov's user avatar
1 vote
1 answer
116 views

Should all my asp.net MVC controllers use Web APIs?

The thing that I don't understand is the prioritization between MVC Controllers and Web APIs. Consider I want to make a website. I can either program to APIs and for the presentational layer, force ...
user335505's user avatar
5 votes
4 answers
2k views

Clean Architecture - What is the difference between Use Cases and Core Services?

I'm trying to apply Clean Architecture to a simple ASP.NET MVC Core app by following Microsoft's ASP.NET architecture guidelines and their eShopOnWeb sample project. In the standard Clean ...
Achilles's user avatar
  • 435
1 vote
4 answers
6k views

How do you manage objects that are shared between back-end services and front-end services/apps?

I have multiple REST-ful APIs that I'm using as my "back-end". I also have multiple web apps (.NET MVC). These web apps make calls to the APIs for data. So, an object being returned by an API will be ...
lioneltwain's user avatar
1 vote
1 answer
356 views

MVC Controller calling UoW (unit of work) directly instead of going through Service Layer

Currently im injecting my Unit of Work inside the controller. I figured out that in most of the designs, controllers calls the service layer and service calls the repository/DAL layer. Most of the ...
David weng's user avatar
1 vote
2 answers
458 views

Handling Authentication with both Web App and API

Not sure how to handle this. Our current app (.Net MVC) is accessed via companyname.appname.com, authentication is handled via forms (cookie) authentication. Within the app there is a global search ...
Gaz's user avatar
  • 159
3 votes
4 answers
1k views

Is dependency injection always a best practice?

Recently I started working on a rather large monolithic system. The solution has web, app and api parts and in general just a lot of stuff. It relies heavily on dependency injection and I noticed ...
Rik D's user avatar
  • 4,490
6 votes
2 answers
4k views

ASP.NET Core - Is using [FromServices] attribute bad practice?

I have a Controller in ASP Core MVC. I'm trying to trim down the dependency injected services in the constructor so I can start building unit tests more easily. However, I have some services being ...
Brad's user avatar
  • 425
-1 votes
2 answers
93 views

Is there an accepted way to track record metadata, CreatedOn/By etc?

I've worked with a lot of off-the-shelf systems and generally speaking they all, at a database level and above, have metadata such as CreatedBy/On, ModifiedBy/On etc against records/entities to give ...
David's user avatar
  • 153
-1 votes
1 answer
41 views

where to put business constraints

We have a 3-tier architecture: Web, Business, Models using the MVC pattern. Models are Code-First using EF6. Currently we access the dbContext directly in our Controllers to query and save changes. We ...
Riz's user avatar
  • 196

1
2 3 4 5
12