Create service layer in asp.net mvc
To update the Entity of the database (tables), we directly inherit the Model Entity to view the page, for example
<%@ Page Title="Edit" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MVCProject.Models.Preson>" %>
And after that the Post Post Edit method is called from the controller and finally the Entity updates. The savechanges method of the LINQ or EF class.
But the user is allowed to update the "Preson" object only for the selected fields, the rest of the fields should be set automatically.
The user should only have selected values that can be edited in his view. And Entity should be inherited from our service layer for example.
<MVCProject.ServiceLayer.Preson>
...
This will be the best way to split your application into buses.
Now, does anyone know how to create classes at the service level and map them to the databasecontext (in the case of a LINQ class)?
a source to share
Check out this tutorial , it has a ton of information on abstracting the service layer for an MVC application.
a source to share