{"id":1168,"date":"2023-08-12T15:30:06","date_gmt":"2023-08-12T15:30:06","guid":{"rendered":"https:\/\/dijix.com.ua\/blog\/?p=1168"},"modified":"2023-08-12T15:30:06","modified_gmt":"2023-08-12T15:30:06","slug":"prilozhenie-asp-net-mvc-crud","status":"publish","type":"post","link":"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/","title":{"rendered":"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud"},"content":{"rendered":"<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e Asp.Net Mvc Crud \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c EF Core \u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.<\/p>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 <strong>User<\/strong>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0443\u044e \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p><span style=\"font-weight: 400;\">\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0436\u0438\u0434\u0430\u044e \u043e\u0442 \u0432\u0430\u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439 Entity Framework Core, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445, \u0432\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0441\u0442\u0430\u043d\u0443.<\/span><\/p>\n<h2>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud<\/h2>\n<p><a href=\"#CreateProject\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a><\/p>\n<p><a href=\"#ModelRepository\">\u041c\u043e\u0434\u0435\u043b\u044c \u0438 \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a><\/p>\n<p><a href=\"#ControllersViews\">\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/a><\/p>\n<p><a href=\"#EfCoreData\">\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 Entity Framework Core<\/a><\/p>\n<h2 id=\"CreateProject\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p><span style=\"font-weight: 400;\">\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 <\/span><b>Users<\/b><span style=\"font-weight: 400;\">, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 Visual Studio \u0438 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0432 \u043c\u0435\u043d\u044e File (\u0424\u0430\u0439\u043b) &#8212; New Project (\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u041f\u0440\u043e\u0435\u043a\u0442). \u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u043e\u0435\u043a\u0442\u0430 ASP.NET Core Web Application (\u0412\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 ASP.NET Core). \u0412\u0432\u0435\u0434\u0438\u0442\u0435 <\/span><b>UsersCrud,<\/b><span style=\"font-weight: 400;\"> \u0432 \u043f\u043e\u043b\u0435 Name, \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 Framework .Net 7.0 \u0438 \u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 <\/span><b>Create<\/b><span style=\"font-weight: 400;\">:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1169\" src=\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/1-1.png\" alt=\"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud\" width=\"970\" height=\"607\" srcset=\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/1-1.png 970w, https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/1-1-300x188.png 300w, https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/1-1-768x481.png 768w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/p>\n<h2 id=\"ModelRepository\">\u041c\u043e\u0434\u0435\u043b\u044c \u0438 \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/h2>\n<p><span style=\"font-weight: 400;\">\u041c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <b>UsersCrud <\/b><\/span><span style=\"font-weight: 400;\">\u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043f\u043a\u0443 <\/span><b>Models<\/b><span style=\"font-weight: 400;\"> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 <strong>User<\/strong><\/span><b>.cs<\/b><span style=\"font-weight: 400;\"> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/span><\/p>\n<pre class=\"lang:default decode:true\">public class User\r\n    {\r\n        public string Id { get; set; } = Guid.NewGuid().ToString();\r\n        public string Email { get; set; }\r\n        public string? Name { get; set; }\r\n        public int Age { get; set; }\r\n    }<\/pre>\n<p><span style=\"font-weight: 400;\">\u041c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0441 \u0438\u0441\u00ad\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 &#171;\u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435&#187; (Repository), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u043c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 &#171;\u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435&#187; \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u0438 MVC \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0434\u0435\u0442\u0430\u043b\u0438, \u043a\u0430\u0441\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043a\u0440\u044b\u0442\u044b \u043e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043f\u043a\u0443 <\/span><b>Interfaces<\/b><span style=\"font-weight: 400;\"> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 <\/span><b>IUser.cs<\/b><span style=\"font-weight: 400;\"> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/span><\/p>\n<pre class=\"lang:default decode:true\">public interface IUser\r\n    {\r\n        IEnumerable&lt;User&gt; GetAllUsers();\r\n        User GetUser(string id);\r\n\r\n        void AddUser(User user);\r\n        void UpdateUser(User user);\r\n        void DeleteUser(string id);\r\n    }<\/pre>\n<p><span style=\"font-weight: 400;\">\u041c\u0435\u0442\u043e\u0434 <strong>GetAllUsers<\/strong><\/span><b>()<\/b><span style=\"font-weight: 400;\"> \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0447\u0442\u0435\u043d\u0438\u044e \u043a\u043e \u0432\u0441\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u041c\u0435\u0442\u043e\u0434 <\/span><b>AddUser()<\/b><span style=\"font-weight: 400;\"> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0436\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u044d\u0442\u043e \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 Entity Framework Core. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043f\u043a\u0443 <\/span><b>Repository<\/b><span style=\"font-weight: 400;\"> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 <\/span><b>UserRepository.cs <\/b><span style=\"font-weight: 400;\">\u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/span><\/p>\n<pre class=\"lang:default decode:true\">public class UserRepository : IUser\r\n    {\r\n        private List&lt;User&gt; _users;\r\n\r\n        public UserRepository()\r\n        {\r\n            _users = new List&lt;User&gt;()\r\n            {\r\n                new User { Name = \"Alex\", Age = 30, Email = \"alex@gmail.com\"},\r\n                new User { Name = \"Marry\", Age = 19, Email = \"marry@gmail.com\"},\r\n                new User { Name = \"Tom\", Age = 27, Email = \"tom@gmail.com\"},\r\n                new User { Name = \"Karen\", Age = 38, Email = \"karen@gmail.com\"},\r\n                new User { Name = \"John\", Age = 41, Email = \"john@gmail.com\"}\r\n            };\r\n        }\r\n\r\n        public void AddUser(User user)\r\n        {\r\n            user.Id = Guid.NewGuid().ToString();\r\n            _users.Add(user);\r\n        }\r\n\r\n        public void DeleteUser(string id)\r\n        {\r\n            _users.Remove(GetUser(id));\r\n        }\r\n\r\n        public IEnumerable&lt;User&gt; GetAllUsers()\r\n        {\r\n            return _users;\r\n        }\r\n\r\n        public User GetUser(string id)\r\n        {\r\n            return _users.FirstOrDefault(e =&gt; e.Id.ToString().Equals(id));\r\n        }\r\n\r\n        public void UpdateUser(User user)\r\n        {\r\n            var currentUser = _users.FirstOrDefault(e =&gt; e.Id.ToString().Equals(user.Id));\r\n            if (currentUser != null)\r\n            {\r\n                currentUser.Name = user.Name; \r\n                currentUser.Email = user.Email; \r\n                currentUser.Age = user.Age; \r\n            }\r\n        }\r\n    }<\/pre>\n<p><span style=\"font-weight: 400;\">\u041a\u043b\u0430\u0441\u0441 <\/span><b>UserRepository<\/b><span style=\"font-weight: 400;\"> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <\/span><b>IUser<\/b><span style=\"font-weight: 400;\"> \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 List \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <\/span><b>User<\/b><span style=\"font-weight: 400;\">, \u0442.\u0435. \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u0442\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f. \u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u043f\u043e\u0437\u0436\u0435, \u0430 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 ASP.NET Core \u041cV\u0421 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0447\u0430\u0441\u0442\u044c EntityFramework Core.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441 Program \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440,\u00a0 \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 <b>UserRepository<\/b> <\/span><span style=\"font-weight: 400;\">\u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u00ad\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <b>IUser<\/b><\/span><span style=\"font-weight: 400;\">:<\/span><\/p>\n<pre class=\"lang:default decode:true\">builder.Services.AddSingleton&lt;IUser, UserRepository&gt;();<\/pre>\n<p><span style=\"font-weight: 400;\">\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u043e\u0434\u0430, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 <b>UserRepository<\/b> <\/span><span style=\"font-weight: 400;\">\u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430 <strong>AddSingleton<\/strong>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <b>IUser<\/b><\/span><span style=\"font-weight: 400;\">\u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/span><\/p>\n<p>\u041f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043f\u0430\u043f\u043a\u0443 <strong>ViewModels<\/strong>, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043b\u0430\u0441\u0441 <strong>UserViewModel<\/strong>, \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre class=\"lang:default decode:true \">public class UserViewModel\r\n    {\r\n        [Key]\r\n        public string? Id { get; set; }\r\n\r\n        [Required]\r\n        [DataType(DataType.EmailAddress)]\r\n        public string? Email { get; set; }\r\n\r\n        public string? Name { get; set; }\r\n\r\n        [Required]\r\n        [Range(10,120)]\r\n        public int Age { get; set; }\r\n    }<\/pre>\n<p>\u041c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c (\u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c) \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c. \u041c\u043e\u0434\u0435\u043b\u044c <strong>UserViewModel<\/strong> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0431\u043e\u0440 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 (\u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435\u0439) \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 (\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c).<\/p>\n<p>\u0423\u043a\u0430\u0437\u0430\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442<strong> [Required]<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a\u0436\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <strong>[Range(10, 120)]<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430 \u043e\u0442 10 \u0434\u043e 120.<\/p>\n<h2 id=\"ControllersViews\">\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/h2>\n<p><span style=\"font-weight: 400;\">\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0430\u043a\u0446\u0435\u043d\u0442 \u0432 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u043d \u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u041d\u0422TP-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 User, \u0442\u0430\u043a \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043f\u043a\u0443 <\/span><b>Controllers<\/b><span style=\"font-weight: 400;\">, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b \u043f\u043e \u0438\u043c\u0435\u043d\u0438 <\/span><b>HomeController.cs<\/b><span style=\"font-weight: 400;\">, \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/span><\/p>\n<pre class=\"lang:default decode:true\">public class HomeController : Controller\r\n    {\r\n        private readonly IUser _users;\r\n\r\n        public HomeController(IUser users)\r\n        {\r\n            _users = users;\r\n        }\r\n\r\n        [HttpGet]\r\n        public IActionResult Index()\r\n        {\r\n            return View(_users.GetAllUsers());\r\n        }\r\n\r\n        [HttpGet]\r\n        public IActionResult CreateOrUpdate(string? userId)\r\n        {\r\n            if (userId != null)\r\n            {\r\n                var currentUser = _users.GetUser(userId);\r\n                if (currentUser != null)\r\n                {\r\n                    return View(new UserViewModel\r\n                    {\r\n                        Id = currentUser.Id,\r\n                        Name = currentUser.Name,\r\n                        Email = currentUser.Email,\r\n                        Age = currentUser.Age\r\n                    });\r\n                }\r\n            }\r\n            return View();\r\n        }\r\n\r\n        [HttpPost]\r\n        [AutoValidateAntiforgeryToken]\r\n        public IActionResult CreateOrUpdate(UserViewModel uvm)\r\n        {\r\n            if (ModelState.IsValid)\r\n            {\r\n                var user = new User\r\n                {\r\n                    Id = uvm.Id,\r\n                    Name = uvm.Name,\r\n                    Email = uvm.Email,\r\n                    Age = uvm.Age\r\n                };\r\n                if (uvm.Id is null)\r\n                {\r\n                    _users.AddUser(user);\r\n                }\r\n                else\r\n                {\r\n                    _users.UpdateUser(user);\r\n                }\r\n                return RedirectToAction(nameof(Index));\r\n            }\r\n            return View(uvm);\r\n        }\r\n\r\n        [HttpPost]\r\n        [AutoValidateAntiforgeryToken]\r\n        public IActionResult Delete(string userId)\r\n        {\r\n            _users.DeleteUser(userId);\r\n            return RedirectToAction(nameof(Index));\r\n        }\r\n    }<\/pre>\n<p><span style=\"font-weight: 400;\">\u041c\u0435\u0442\u043e\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f <\/span><b>Index()<\/b><span style=\"font-weight: 400;\"> \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <\/span><span style=\"font-weight: 400;\"><b>User <\/b><\/span><span style=\"font-weight: 400;\">\u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0441\u0432\u043e\u0435\u043c\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u044d\u043a\u0440\u0430\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u00ad\u043c\u0438. \u041c\u0435\u0442\u043e\u0434 <\/span><b>AddUser()<\/b><span style=\"font-weight: 400;\"> \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Product, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u041d\u0422TP-\u0437\u0430\u043f\u0440\u043e\u0441\u0435 POST \u0438 \u0442.\u0434.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043f\u043a\u0443 <\/span><b>Views\/Home<\/b><span style=\"font-weight: 400;\"> \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b \u043f\u043e \u0438\u043c\u0435\u043d\u0438 <\/span><b>Index.cshtml<\/b><span style=\"font-weight: 400;\"> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:\u00a0<\/span><\/p>\n<pre class=\"lang:default decode:true\">@{\r\n    ViewData[\"Title\"] = \"All Users\";\r\n}\r\n@model IEnumerable&lt;User&gt;\r\n\r\n&lt;div class=\"text-center\"&gt;\r\n    &lt;h1 class=\"display-4\"&gt;All Users&lt;\/h1&gt;\r\n    &lt;div class=\"row g-4 py-5 row-cols-1\"&gt;\r\n        &lt;div&gt;\r\n            &lt;a asp-controller=\"Home\" asp-action=\"CreateOrUpdate\" class=\"btn btn-primary\"&gt;Create User&lt;\/a&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n\r\n    @if (Model.Count() == 0)\r\n    {\r\n        &lt;div class=\"row\"&gt;\r\n            &lt;div class=\"col text-center p-2\"&gt;No data&lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    }\r\n    else\r\n    {\r\n        &lt;div class=\"p-5 mb-4 bg-light rounded-3 ovx\"&gt;\r\n            &lt;table class=\"table table-hover\"&gt;\r\n                &lt;tr&gt;&lt;th&gt;Id&lt;\/th&gt;&lt;th&gt;Name&lt;\/th&gt;&lt;th&gt;Email&lt;\/th&gt;&lt;th&gt;Age&lt;\/th&gt;&lt;th&gt;&lt;\/th&gt;&lt;th&gt;&lt;\/th&gt;&lt;\/tr&gt;\r\n                @foreach (User user in Model)\r\n                {\r\n                    &lt;tr&gt;\r\n                        &lt;td&gt;@user.Id&lt;\/td&gt;\r\n                        &lt;td&gt;@user.Name&lt;\/td&gt;\r\n                        &lt;td&gt;@user.Email&lt;\/td&gt;\r\n                        &lt;td&gt;@user.Age&lt;\/td&gt;\r\n                        &lt;td&gt;\r\n                            &lt;a class=\"btn btn-sm btn-primary\" asp-controller=\"Home\" asp-action=\"CreateOrUpdate\" asp-route-userId=\"@user.Id\"&gt;Update&lt;\/a&gt;\r\n                        &lt;\/td&gt;\r\n                        &lt;td&gt;\r\n                            &lt;form asp-controller=\"Home\" asp-action=\"Delete\" asp-route-userId=\"@user.Id\" method=\"post\"&gt;\r\n                                &lt;button type=\"submit\" class=\"btn btn-sm btn-danger\"&gt;Delete&lt;\/button&gt;\r\n                            &lt;\/form&gt;\r\n                        &lt;\/td&gt;\r\n                    &lt;\/tr&gt;\r\n                }\r\n            &lt;\/table&gt;\r\n        &lt;\/div&gt;\r\n    }\r\n&lt;\/div&gt;\r\n<\/pre>\n<p>\u0414\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 <strong>User<\/strong>, \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445.<\/p>\n<p><span style=\"font-weight: 400;\">\u0412 \u043f\u0430\u043f\u043a\u0443 <\/span><b>Views\/Home<\/b>,<span style=\"font-weight: 400;\"> \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0444\u0430\u0439\u043b \u043f\u043e \u0438\u043c\u0435\u043d\u0438 <strong>CreateOrUpdate<\/strong><\/span><b>.cshtml<\/b><span style=\"font-weight: 400;\"> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:\u00a0<\/span><\/p>\n<pre class=\"lang:default decode:true\">@using UsersCrud.ViewModels;\r\n@{\r\n    ViewData[\"Title\"] = \"Create \/ Update User\";\r\n}\r\n@model UserViewModel\r\n\r\n&lt;div class=\"container px-4 py-5\" id=\"hanging-icons\"&gt;\r\n    &lt;h2 class=\"pb-2 border-bottom\"&gt;Create \/ Update User&lt;\/h2&gt;\r\n\r\n    &lt;a asp-controller=\"Home\" asp-action=\"Index\"&gt;Home&lt;\/a&gt;\r\n\r\n    &lt;div class=\"row g-4 py-5 row-cols-1\"&gt;\r\n        &lt;div class=\"p-5 mb-4 bg-light rounded-3 \"&gt;\r\n\r\n            &lt;form asp-controller=\"Home\" asp-action=\"CreateOrUpdate\" method=\"post\"&gt;\r\n\r\n                &lt;div asp-validation-summary=\"All\" class=\"text-danger\"&gt;&lt;\/div&gt;\r\n\r\n                &lt;input type=\"hidden\" asp-for=\"Id\" \/&gt;\r\n\r\n                &lt;div class=\"form-group\"&gt;\r\n                    &lt;label asp-for=\"Name\" class=\"control-label\"&gt;&lt;\/label&gt;\r\n                    &lt;input type=\"text\" asp-for=\"Name\" class=\"form-control\" \/&gt;\r\n                    &lt;span asp-validation-for=\"Name\" class=\"text-danger\"&gt;&lt;\/span&gt;\r\n\r\n                &lt;\/div&gt;\r\n\r\n                &lt;div class=\"form-group\"&gt;\r\n                    &lt;label asp-for=\"Email\" class=\"control-label\"&gt;&lt;\/label&gt;\r\n                    &lt;input type=\"text\" asp-for=\"Email\" class=\"form-control\" \/&gt;\r\n                    &lt;span asp-validation-for=\"Email\" class=\"text-danger\"&gt;&lt;\/span&gt;\r\n\r\n                &lt;\/div&gt;\r\n\r\n                &lt;div class=\"form-group mb-3\"&gt;\r\n                    &lt;label asp-for=\"Age\" class=\"control-label\"&gt;&lt;\/label&gt;\r\n                    &lt;input type=\"text\" asp-for=\"Age\" class=\"form-control\" \/&gt;\r\n                    &lt;span asp-validation-for=\"Age\" class=\"text-danger\"&gt;&lt;\/span&gt;\r\n\r\n                &lt;\/div&gt;\r\n\r\n                &lt;div class=\"form-group\"&gt;\r\n                    &lt;input type=\"submit\" value=\"Save\" class=\"btn btn-primary\" \/&gt;\r\n                &lt;\/div&gt;\r\n            &lt;\/form&gt;\r\n\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/div&gt;\r\n\r\n<\/pre>\n<p>\u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e. \u041f\u043e\u043b\u044f \u0444\u043e\u0440\u043c\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 <strong>UserViewModel<\/strong>, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0443:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1170\" src=\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/2-1.png\" alt=\"users crud asp.net core mvc\" width=\"717\" height=\"692\" srcset=\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/2-1.png 717w, https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/2-1-300x290.png 300w\" sizes=\"auto, (max-width: 717px) 100vw, 717px\" \/><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d.<\/p>\n<h2 id=\"EfCoreData\">\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 Entity Framework Core<\/h2>\n<p><span style=\"font-weight: 400;\">\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 Entity Framework Core \u0432 \u043f\u0440\u043e\u0435\u043a\u0442, \u0447\u0442\u043e \u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u0430\u043a \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0440\u0438 \u044d\u0442\u043e \u0432\u043d\u0435\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Entity Framework Core Sql Server:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1171\" src=\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/3-1.png\" alt=\"asp.net mvc ef core crud\" width=\"778\" height=\"360\" srcset=\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/3-1.png 778w, https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/3-1-300x139.png 300w, https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/3-1-768x355.png 768w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">\u0418\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 <strong>Package Manager Console<\/strong>:<\/span><\/p>\n<pre class=\"lang:default decode:true\">Install-Package Microsoft.EntityFrameworkCore.SqlServer<\/pre>\n<p><span style=\"font-weight: 400;\">\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u0444\u0430\u0439\u043b <\/span><b>appsettings.json<\/b><span style=\"font-weight: 400;\"> \u0438 \u043f\u0440\u043e\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b\u0430 \u043d\u0435\u0442, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430):<\/span><\/p>\n<pre class=\"lang:default decode:true \">{\r\n  \"ConnectionStrings\": {\r\n    \"DefaultConnection\": \"Server=(localdb)\\\\mssqllocaldb;Database=usersCrudDb;Trusted_Connection=True;\"\r\n  },\r\n  \"Logging\": {\r\n    \"LogLevel\": {\r\n      \"Default\": \"Information\",\r\n      \"Microsoft.AspNetCore\": \"Information\"\r\n    }\r\n  },\r\n  \"AllowedHosts\": \"*\"\r\n}\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">\u0421\u0442\u0440\u043e\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <\/span><b>appsettings.json<\/b><span style=\"font-weight: 400;\">, \u0432 \u043a\u043e\u0434\u0435 \u0432\u044b\u0448\u0435, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0411\u0414 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f GameStore. \u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u0435\u0440\u0441\u0438\u044f <\/span><b>LocalDB<\/b><span style=\"font-weight: 400;\"> \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 SQL Server, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0412\u044b \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043d\u0435\u0440\u0430\u0437\u0440\u044b\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439. \u0424\u043e\u0440\u043c\u0430\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u043d \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0414\u0430\u0436\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0449\u0435\u043c \u043b\u0438\u0448\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b SQL, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Entity Framework Core \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445.<\/span><\/p>\n<p>\u0412 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043f\u0430\u043f\u043a\u0443 <strong>Data<\/strong>, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043b\u0430\u0441\u0441 <strong>ApplicationContext<\/strong>, \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre class=\"lang:default decode:true\">public class ApplicationContext : DbContext\r\n    {\r\n        public ApplicationContext(DbContextOptions&lt;ApplicationContext&gt; context) : base(context)\r\n        {\r\n\r\n        }\r\n        public DbSet&lt;User&gt; Users{ get; set; }\r\n    }<\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0440\u0430 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435. \u0418\u0437\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 <strong>UserRepository<\/strong>, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre class=\"lang:default decode:true\">public class UserRepository : IUser\r\n    {\r\n        private readonly ApplicationContext _context;\r\n\r\n        public UserRepository(ApplicationContext context)\r\n        {\r\n            _context = context;\r\n        }\r\n\r\n        public void AddUser(User user)\r\n        {\r\n             user.Id = Guid.NewGuid().ToString();\r\n            _context.Users.Add(user);\r\n            _context.SaveChanges();\r\n        }\r\n\r\n        public void DeleteUser(string id)\r\n        {\r\n            _context.Users.Remove(new User { Id = id });\r\n            _context.SaveChanges();\r\n        }\r\n\r\n        public IEnumerable&lt;User&gt; GetAllUsers()\r\n        {\r\n            return _context.Users.ToList();\r\n        }\r\n\r\n        public User GetUser(string id)\r\n        {\r\n            return _context.Users.FirstOrDefault(e =&gt; e.ToString().Equals(id));\r\n        }\r\n\r\n        public void UpdateUser(User user)\r\n        {\r\n            _context.Users.Update(user);\r\n            _context.SaveChanges();\r\n        }\r\n    }<\/pre>\n<p><span style=\"font-weight: 400;\">\u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 ASP.NET Core MVC, \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438 \u043f\u043e\u0442\u043e\u043c\u0443 \u0432 \u043a\u043b\u0430\u0441\u0441 <\/span><b>UserRepository<\/b><span style=\"font-weight: 400;\"> \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <\/span><b>ApplicationContext<\/b><span style=\"font-weight: 400;\">, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e <\/span><b>Users<\/b><span style=\"font-weight: 400;\">, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043f\u0443\u0442\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <\/span><b>DbSet&lt;User&gt;,<\/b><span style=\"font-weight: 400;\"> \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u0435\u0442\u043e\u0434 <\/span><b>AddUser()<\/b><span style=\"font-weight: 400;\"> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0435\u0433\u043a\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 <\/span><b>DbSet&lt;Product&gt;<\/b><span style=\"font-weight: 400;\"> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <\/span><b>Add(),<\/b><span style=\"font-weight: 400;\"> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b User \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0445 \u043d\u0430 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441 <\/span><b>Program.cs<\/b><span style=\"font-weight: 400;\"> \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 Entity Framework Core \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u0411\u0414, \u0438 \u043a\u0430\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430:<\/span><\/p>\n<pre class=\"lang:default decode:true\">builder.Services.AddTransient&lt;IUser, UserRepository&gt;();\r\n\r\nbuilder.Services.AddDbContext&lt;ApplicationContext&gt;(opts =&gt; {\r\n    opts.UseSqlServer(\r\n    builder.Configuration[\"ConnectionStrings:DefaultConnection\"]);\r\n});\r\n<\/pre>\n<p>\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0443\u0431\u0440\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0435 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b:<\/p>\n<pre class=\"lang:default decode:true\">builder.Services.AddSingleton&lt;IUser, UserRepository&gt;();<\/pre>\n<p><span style=\"font-weight: 400;\">\u0418\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Entity Framework Core \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0431\u043e\u0440\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0438\u0445 \u0438\u043b\u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0411\u0414 \u0441 \u0446\u0435\u043b\u044c\u044e \u0435\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0434\u0430\u043d\u043d\u044b\u0445.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0435\u0439, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 &#8212; <strong>Microsoft.EntityFrameworkCore.Tools<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0418\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 Package Manager Console:<\/span><\/p>\n<pre class=\"lang:default decode:true\">Install-Package Microsoft.EntityFrameworkCore.Tools<\/pre>\n<p><span style=\"font-weight: 400;\">\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 \u043e\u043a\u043d\u0435<\/span><b> Package Manager Console<\/b><span style=\"font-weight: 400;\"> \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:\u00a0<\/span><\/p>\n<pre class=\"lang:default decode:true\">Add-Migration Init<\/pre>\n<p><b>Init<\/b><span style=\"font-weight: 400;\"> \u0438\u043b\u0438 <\/span><b>Initial<\/b><span style=\"font-weight: 400;\"> &#8212; \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0435 \u0438\u043c\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u0434\u043b\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0411\u0414.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Entity Framework \u0421o\u0433\u0435 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432 \u043e\u043a\u043d\u0435 Solution Explorer \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u0430 <strong>Migrations<\/strong>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0444\u0430\u0439\u043b\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u044f\u0442 \u0411\u0414.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u041f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0411\u0414, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043c\u043e\u0436\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u0432 \u043e\u043a\u043d\u0435<\/span><b> Package Manager Console<\/b><span style=\"font-weight: 400;\"> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/span><\/p>\n<pre class=\"lang:default decode:true\">Update-Database<\/pre>\n<p><span style=\"font-weight: 400;\">\u0418\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Entity F\u0433amework Core \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0432 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0411\u0414, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <strong>User<\/strong>.<\/span><\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0443. \u041f\u0440\u043e\u0435\u043a\u0442 \u0431\u044b\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u0447\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0435\u0449\u0438 \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u043b \u0431\u044b \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<p>\u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0447\u0438\u0442\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e, \u0438 \u043e\u043d\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043b\u0435\u0433\u043a\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0434\u0430\u0439\u0442\u0435 \u043c\u043d\u0435 \u0437\u043d\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0438\u043b\u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0432\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f &#8212; <a href=\"https:\/\/dijix.com.ua\/blog\/priem-platezhej-cherez-liqpay-api-v-asp-net-core\/\">\u041f\u0440\u0438\u0435\u043c \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 Liqpay Api \u0432 Asp.Net Core<\/a>.<\/p>\n<hr \/>\n<h4><strong>\u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043d\u0430\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f C#?<\/strong><\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u0438\u0437 \u0441\u0430\u0439\u0442\u043e\u0432, \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c-\u0431\u043e\u0442\u043e\u0432 \u0438 \u0442.\u0434.<\/p>\n<p><a href=\"https:\/\/dijix.com.ua\/\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-94 size-full\" src=\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2022\/08\/logog-brand.png\" alt=\"\" width=\"355\" height=\"77\" srcset=\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2022\/08\/logog-brand.png 355w, https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2022\/08\/logog-brand-300x65.png 300w\" sizes=\"auto, (max-width: 355px) 100vw, 355px\" \/><\/a><\/p>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u0435 \u043a \u043d\u0430\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <strong><a href=\"https:\/\/dijix.com.ua\/\">Dijix<\/a>\u00a0<\/strong>\u0438 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u043c\u044b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043d\u044f\u0442\u0438\u044f\u0445, \u043a\u0430\u043a \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0437\u044f\u0442\u044c \u043a\u0430\u043a \u043e\u0434\u043d\u043e \u0437\u0430\u043d\u044f\u0442\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u0412\u0430\u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u0442\u0430\u043a \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u043e\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043b\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0443, \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0442\u0443\u0434\u0435\u043d\u0442 \u043f\u043e\u0432\u044b\u0441\u0438\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0432\u00a0\u0432\u0430\u0448\u0435\u043c \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0438:<\/p>\n<ul>\n<li>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u043e\u043c\u0443 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0443<\/li>\n<li>\u0422\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438<\/li>\n<li>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043a\u043d\u0438\u0433<\/li>\n<li>\u041e\u043d\u043b\u0430\u0439\u043d \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/li>\n<li>\u041e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u0433\u0440\u0443\u043f\u043f\u0430\u0445<\/li>\n<\/ul>\n<blockquote>\n<p style=\"text-align: right;\"><a href=\"https:\/\/dijix.com.ua\/\">https:\/\/dijix.com.ua<\/a><\/p>\n<p style=\"text-align: right;\">\u0416\u0438\u0432\u0438 \u0432 \u0441\u0432\u043e\u0435\u043c \u043c\u0438\u0440\u0435, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u0439 \u0432 <a href=\"https:\/\/ms.dijix.com.ua\/\">\u043d\u0430\u0448\u0435\u043c<\/a>.<\/p>\n<\/blockquote>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e Asp.Net Mvc Crud \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c EF Core \u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435<span class=\"screen-reader-text\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":1170,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ru_RU","_original_post":"https:\/\/dijix.com.ua\/blog\/?p=1168","footnotes":""},"categories":[8],"tags":[],"class_list":["post-1168","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-asp-net-core","ru-RU","entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.13 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud - Dijix - \u0411\u043b\u043e\u0433<\/title>\r\n<meta name=\"description\" content=\"\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e Asp.Net Mvc Crud \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c EF Core \u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/\" \/>\r\n<meta property=\"og:locale\" content=\"ru_RU\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud - Dijix - \u0411\u043b\u043e\u0433\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/\" \/>\r\n<meta property=\"og:site_name\" content=\"Dijix - \u0411\u043b\u043e\u0433\" \/>\r\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Dijixs\" \/>\r\n<meta property=\"article:published_time\" content=\"2023-08-12T15:30:06+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/2-1.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"717\" \/>\r\n\t<meta property=\"og:image:height\" content=\"692\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"\u041b\u0435\u043e\u043d\u0438\u0434 \u041a\u0430\u0440\u0443\u043d\u0430\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0430\u0432\u0442\u043e\u0440\u043e\u043c\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u041b\u0435\u043e\u043d\u0438\u0434 \u041a\u0430\u0440\u0443\u043d\u0430\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u043c\u0438\u043d\u0443\u0442\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/\"},\"author\":{\"name\":\"\u041b\u0435\u043e\u043d\u0438\u0434 \u041a\u0430\u0440\u0443\u043d\u0430\",\"@id\":\"https:\/\/dijix.com.ua\/blog\/#\/schema\/person\/4ce2240cdf3db189e17ca0ff422a0c3d\"},\"headline\":\"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud\",\"datePublished\":\"2023-08-12T15:30:06+00:00\",\"dateModified\":\"2023-08-12T15:30:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/\"},\"wordCount\":1310,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\/\/dijix.com.ua\/blog\/#organization\"},\"articleSection\":[\"Asp.Net Core\"],\"inLanguage\":\"ru-RU\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/\",\"url\":\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/\",\"name\":\"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud - Dijix - \u0411\u043b\u043e\u0433\",\"isPartOf\":{\"@id\":\"https:\/\/dijix.com.ua\/blog\/#website\"},\"datePublished\":\"2023-08-12T15:30:06+00:00\",\"dateModified\":\"2023-08-12T15:30:06+00:00\",\"description\":\"\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e Asp.Net Mvc Crud \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c EF Core \u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.\",\"breadcrumb\":{\"@id\":\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/#breadcrumb\"},\"inLanguage\":\"ru-RU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\",\"item\":\"https:\/\/dijix.com.ua\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dijix.com.ua\/blog\/#website\",\"url\":\"https:\/\/dijix.com.ua\/blog\/\",\"name\":\"Dijix - \u0411\u043b\u043e\u0433\",\"description\":\"\ud83d\udc9c\",\"publisher\":{\"@id\":\"https:\/\/dijix.com.ua\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dijix.com.ua\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"ru-RU\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dijix.com.ua\/blog\/#organization\",\"name\":\"Dijix - \u0411\u043b\u043e\u0433\",\"url\":\"https:\/\/dijix.com.ua\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\/\/dijix.com.ua\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2022\/08\/\u0421\u043d\u0438\u043c\u043e\u043a.png\",\"contentUrl\":\"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2022\/08\/\u0421\u043d\u0438\u043c\u043e\u043a.png\",\"width\":159,\"height\":92,\"caption\":\"Dijix - \u0411\u043b\u043e\u0433\"},\"image\":{\"@id\":\"https:\/\/dijix.com.ua\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Dijixs\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/dijix.com.ua\/blog\/#\/schema\/person\/4ce2240cdf3db189e17ca0ff422a0c3d\",\"name\":\"\u041b\u0435\u043e\u043d\u0438\u0434 \u041a\u0430\u0440\u0443\u043d\u0430\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\/\/dijix.com.ua\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e3e8fa72f5adf168d30934fb574a97a5e812e7d6e2795075f0e7ea19311e3ba9?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e3e8fa72f5adf168d30934fb574a97a5e812e7d6e2795075f0e7ea19311e3ba9?s=96&d=monsterid&r=g\",\"caption\":\"\u041b\u0435\u043e\u043d\u0438\u0434 \u041a\u0430\u0440\u0443\u043d\u0430\"},\"sameAs\":[\"https:\/\/dijix.com.ua\/blog\"],\"url\":\"https:\/\/dijix.com.ua\/blog\/author\/admin\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud - Dijix - \u0411\u043b\u043e\u0433","description":"\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e Asp.Net Mvc Crud \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c EF Core \u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/","og_locale":"ru_RU","og_type":"article","og_title":"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud - Dijix - \u0411\u043b\u043e\u0433","og_url":"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/","og_site_name":"Dijix - \u0411\u043b\u043e\u0433","article_publisher":"https:\/\/www.facebook.com\/Dijixs","article_published_time":"2023-08-12T15:30:06+00:00","og_image":[{"width":717,"height":692,"url":"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2023\/08\/2-1.png","type":"image\/png"}],"author":"\u041b\u0435\u043e\u043d\u0438\u0434 \u041a\u0430\u0440\u0443\u043d\u0430","twitter_card":"summary_large_image","twitter_misc":{"\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0430\u0432\u0442\u043e\u0440\u043e\u043c":"\u041b\u0435\u043e\u043d\u0438\u0434 \u041a\u0430\u0440\u0443\u043d\u0430","\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f":"8 \u043c\u0438\u043d\u0443\u0442"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/#article","isPartOf":{"@id":"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/"},"author":{"name":"\u041b\u0435\u043e\u043d\u0438\u0434 \u041a\u0430\u0440\u0443\u043d\u0430","@id":"https:\/\/dijix.com.ua\/blog\/#\/schema\/person\/4ce2240cdf3db189e17ca0ff422a0c3d"},"headline":"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud","datePublished":"2023-08-12T15:30:06+00:00","dateModified":"2023-08-12T15:30:06+00:00","mainEntityOfPage":{"@id":"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/"},"wordCount":1310,"commentCount":3,"publisher":{"@id":"https:\/\/dijix.com.ua\/blog\/#organization"},"articleSection":["Asp.Net Core"],"inLanguage":"ru-RU","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/","url":"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/","name":"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud - Dijix - \u0411\u043b\u043e\u0433","isPartOf":{"@id":"https:\/\/dijix.com.ua\/blog\/#website"},"datePublished":"2023-08-12T15:30:06+00:00","dateModified":"2023-08-12T15:30:06+00:00","description":"\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439, \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e Asp.Net Mvc Crud \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432 \u0434\u0432\u0443\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445: \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c EF Core \u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.","breadcrumb":{"@id":"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/#breadcrumb"},"inLanguage":"ru-RU","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dijix.com.ua\/blog\/prilozhenie-asp-net-mvc-crud\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430","item":"https:\/\/dijix.com.ua\/blog\/"},{"@type":"ListItem","position":2,"name":"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Asp.Net Mvc Crud"}]},{"@type":"WebSite","@id":"https:\/\/dijix.com.ua\/blog\/#website","url":"https:\/\/dijix.com.ua\/blog\/","name":"Dijix - \u0411\u043b\u043e\u0433","description":"\ud83d\udc9c","publisher":{"@id":"https:\/\/dijix.com.ua\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dijix.com.ua\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"ru-RU"},{"@type":"Organization","@id":"https:\/\/dijix.com.ua\/blog\/#organization","name":"Dijix - \u0411\u043b\u043e\u0433","url":"https:\/\/dijix.com.ua\/blog\/","logo":{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/dijix.com.ua\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2022\/08\/\u0421\u043d\u0438\u043c\u043e\u043a.png","contentUrl":"https:\/\/dijix.com.ua\/blog\/wp-content\/uploads\/2022\/08\/\u0421\u043d\u0438\u043c\u043e\u043a.png","width":159,"height":92,"caption":"Dijix - \u0411\u043b\u043e\u0433"},"image":{"@id":"https:\/\/dijix.com.ua\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Dijixs"]},{"@type":"Person","@id":"https:\/\/dijix.com.ua\/blog\/#\/schema\/person\/4ce2240cdf3db189e17ca0ff422a0c3d","name":"\u041b\u0435\u043e\u043d\u0438\u0434 \u041a\u0430\u0440\u0443\u043d\u0430","image":{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/dijix.com.ua\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e3e8fa72f5adf168d30934fb574a97a5e812e7d6e2795075f0e7ea19311e3ba9?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e3e8fa72f5adf168d30934fb574a97a5e812e7d6e2795075f0e7ea19311e3ba9?s=96&d=monsterid&r=g","caption":"\u041b\u0435\u043e\u043d\u0438\u0434 \u041a\u0430\u0440\u0443\u043d\u0430"},"sameAs":["https:\/\/dijix.com.ua\/blog"],"url":"https:\/\/dijix.com.ua\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/posts\/1168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/comments?post=1168"}],"version-history":[{"count":1,"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/posts\/1168\/revisions"}],"predecessor-version":[{"id":1172,"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/posts\/1168\/revisions\/1172"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/media\/1170"}],"wp:attachment":[{"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/media?parent=1168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/categories?post=1168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dijix.com.ua\/blog\/wp-json\/wp\/v2\/tags?post=1168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}