From d4903934eafb7184d8788776a2da83c91229129a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=A7=D0=B5=D1=80?= =?UTF-8?q?=D0=BD=D1=8B=D1=88=D0=BE=D0=B2?= Date: Sat, 8 Apr 2023 13:53:31 +0400 Subject: [PATCH] =?UTF-8?q?5.=20=D0=A2=D0=B5=D1=81=D1=82=20=D0=B1=D0=B4,?= =?UTF-8?q?=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5=20Models=20?= =?UTF-8?q?=D0=B8=20Implements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormRegistrationCustomer.Designer.cs | 173 ++++++++++++++++++ LawFirm/LawFirm/FormRegistrationCustomer.cs | 36 ++++ LawFirm/LawFirm/Program.cs | 38 +++- .../SearchModels/ItemSearchModel.cs | 1 + .../LawFirmDatabase/Implements/CaseStorage.cs | 76 ++++++++ .../Implements/CustomerStorage.cs | 76 ++++++++ .../LawFirmDatabase/Implements/ItemStorage.cs | 82 +++++++++ .../Implements/PaymentStorage.cs | 83 +++++++++ .../Implements/ServiceStorage.cs | 89 +++++++++ LawFirm/LawFirmDatabase/Models/Case.cs | 2 +- LawFirm/LawFirmDatabase/Models/Customer.cs | 4 +- LawFirm/LawFirmDatabase/Models/Payment.cs | 2 +- LawFirm/LawFirmDatabase/Models/Service.cs | 2 +- 13 files changed, 652 insertions(+), 12 deletions(-) create mode 100644 LawFirm/LawFirm/FormRegistrationCustomer.Designer.cs create mode 100644 LawFirm/LawFirm/FormRegistrationCustomer.cs create mode 100644 LawFirm/LawFirmDatabase/Implements/CaseStorage.cs create mode 100644 LawFirm/LawFirmDatabase/Implements/CustomerStorage.cs create mode 100644 LawFirm/LawFirmDatabase/Implements/ItemStorage.cs create mode 100644 LawFirm/LawFirmDatabase/Implements/PaymentStorage.cs create mode 100644 LawFirm/LawFirmDatabase/Implements/ServiceStorage.cs diff --git a/LawFirm/LawFirm/FormRegistrationCustomer.Designer.cs b/LawFirm/LawFirm/FormRegistrationCustomer.Designer.cs new file mode 100644 index 0000000..79ef5ab --- /dev/null +++ b/LawFirm/LawFirm/FormRegistrationCustomer.Designer.cs @@ -0,0 +1,173 @@ +namespace LawFirmView +{ + partial class FormRegistrationCustomer + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBoxLogin = new System.Windows.Forms.TextBox(); + this.textBoxPassword = new System.Windows.Forms.TextBox(); + this.textBoxName = new System.Windows.Forms.TextBox(); + this.textBoxSurname = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.buttonRegister = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonAuthorize = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // textBoxLogin + // + this.textBoxLogin.Location = new System.Drawing.Point(121, 47); + this.textBoxLogin.Name = "textBoxLogin"; + this.textBoxLogin.Size = new System.Drawing.Size(100, 23); + this.textBoxLogin.TabIndex = 0; + // + // textBoxPassword + // + this.textBoxPassword.Location = new System.Drawing.Point(121, 76); + this.textBoxPassword.Name = "textBoxPassword"; + this.textBoxPassword.Size = new System.Drawing.Size(100, 23); + this.textBoxPassword.TabIndex = 0; + // + // textBoxName + // + this.textBoxName.Location = new System.Drawing.Point(121, 105); + this.textBoxName.Name = "textBoxName"; + this.textBoxName.Size = new System.Drawing.Size(100, 23); + this.textBoxName.TabIndex = 0; + // + // textBoxSurname + // + this.textBoxSurname.Location = new System.Drawing.Point(121, 134); + this.textBoxSurname.Name = "textBoxSurname"; + this.textBoxSurname.Size = new System.Drawing.Size(100, 23); + this.textBoxSurname.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(32, 50); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(41, 15); + this.label1.TabIndex = 1; + this.label1.Text = "Логин"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(32, 79); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(49, 15); + this.label2.TabIndex = 1; + this.label2.Text = "Пароль"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(32, 108); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(31, 15); + this.label3.TabIndex = 1; + this.label3.Text = "Имя"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(32, 137); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(58, 15); + this.label4.TabIndex = 1; + this.label4.Text = "Фамилия"; + // + // buttonRegister + // + this.buttonRegister.Location = new System.Drawing.Point(32, 176); + this.buttonRegister.Name = "buttonRegister"; + this.buttonRegister.Size = new System.Drawing.Size(131, 23); + this.buttonRegister.TabIndex = 2; + this.buttonRegister.Text = "Зарегистрироваться"; + this.buttonRegister.UseVisualStyleBackColor = true; + this.buttonRegister.Click += new System.EventHandler(this.buttonRegister_Click); + // + // buttonCancel + // + this.buttonCancel.Location = new System.Drawing.Point(209, 176); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(131, 23); + this.buttonCancel.TabIndex = 2; + this.buttonCancel.Text = "Отмена"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // buttonAuthorize + // + this.buttonAuthorize.Location = new System.Drawing.Point(227, 47); + this.buttonAuthorize.Name = "buttonAuthorize"; + this.buttonAuthorize.Size = new System.Drawing.Size(113, 110); + this.buttonAuthorize.TabIndex = 3; + this.buttonAuthorize.Text = "Авторизоваться"; + this.buttonAuthorize.UseVisualStyleBackColor = true; + // + // FormRegistrationCustomer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(394, 243); + this.Controls.Add(this.buttonAuthorize); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonRegister); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBoxSurname); + this.Controls.Add(this.textBoxName); + this.Controls.Add(this.textBoxPassword); + this.Controls.Add(this.textBoxLogin); + this.Name = "FormRegistrationCustomer"; + this.Text = "FormRegistrationCustomer"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private TextBox textBoxLogin; + private TextBox textBoxPassword; + private TextBox textBoxName; + private TextBox textBoxSurname; + private Label label1; + private Label label2; + private Label label3; + private Label label4; + private Button buttonRegister; + private Button buttonCancel; + private Button buttonAuthorize; + } +} \ No newline at end of file diff --git a/LawFirm/LawFirm/FormRegistrationCustomer.cs b/LawFirm/LawFirm/FormRegistrationCustomer.cs new file mode 100644 index 0000000..856e460 --- /dev/null +++ b/LawFirm/LawFirm/FormRegistrationCustomer.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using LawFirmContracts.BusinessLogicsContracts; +using Microsoft.Extensions.Logging; + +namespace LawFirmView +{ + public partial class FormRegistrationCustomer : Form + { + private readonly ILogger _logger; + private readonly ICustomerLogic _customerLogic; + public FormRegistrationCustomer(ILogger logger, ICustomerLogic customerLogic) + { + _logger = logger; + _customerLogic = customerLogic; + InitializeComponent(); + } + private void buttonRegister_Click(object sender, EventArgs e) + { + _customerLogic.Create(new() + { + Login = textBoxLogin.Text, + Password = textBoxPassword.Text, + Name = textBoxName.Text, + Surname = textBoxSurname.Text + }); + } + } +} diff --git a/LawFirm/LawFirm/Program.cs b/LawFirm/LawFirm/Program.cs index 40cd6a1..33d229c 100644 --- a/LawFirm/LawFirm/Program.cs +++ b/LawFirm/LawFirm/Program.cs @@ -1,19 +1,43 @@ -using LawFirmDatabase; +using LawFirmBusinessLogic.BusinessLogics; +using LawFirmContracts.BusinessLogicsContracts; +using LawFirmContracts.StorageContracts; +using LawFirmDatabase.Implements; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using NLog.Extensions.Logging; namespace LawFirmView { internal static class Program { - /// - /// The main entry point for the application. - /// + private static ServiceProvider? _serviceProvider; + public static ServiceProvider? ServiceProvider => _serviceProvider; [STAThread] static void Main() { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(); + var services = new ServiceCollection(); + ConfigureServices(services); + _serviceProvider = services.BuildServiceProvider(); + Application.Run(_serviceProvider.GetRequiredService()); + } + private static void ConfigureServices(ServiceCollection services) + { + services.AddLogging(option => + { + option.SetMinimumLevel(LogLevel.Information); + option.AddNLog("nlog.config"); + }); + // Storage + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + + services.AddTransient(); } } } \ No newline at end of file diff --git a/LawFirm/LawFirmContracts/SearchModels/ItemSearchModel.cs b/LawFirm/LawFirmContracts/SearchModels/ItemSearchModel.cs index 68d70da..d4e0edb 100644 --- a/LawFirm/LawFirmContracts/SearchModels/ItemSearchModel.cs +++ b/LawFirm/LawFirmContracts/SearchModels/ItemSearchModel.cs @@ -9,5 +9,6 @@ namespace LawFirmContracts.SearchModels public class ItemSearchModel { public int? Id { get; set; } + public string? Name { get; set; } } } diff --git a/LawFirm/LawFirmDatabase/Implements/CaseStorage.cs b/LawFirm/LawFirmDatabase/Implements/CaseStorage.cs new file mode 100644 index 0000000..7b30067 --- /dev/null +++ b/LawFirm/LawFirmDatabase/Implements/CaseStorage.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using LawFirmContracts.BindingModels; +using LawFirmContracts.SearchModels; +using LawFirmContracts.StorageContracts; +using LawFirmContracts.ViewModels; +using LawFirmDatabase.Models; + +namespace LawFirmDatabase.Implements +{ + public class CaseStorage : ICaseStorage + { + public List GetFullList() + { + using var context = new LawFirmDBContext(); + return context.Cases.Select(x => x.GetViewModel).ToList(); + } + public List GetFilteredList(CaseSearchModel model) + { + using var context = new LawFirmDBContext(); + return context.Cases.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList(); + } + public CaseViewModel? GetElement(CaseSearchModel model) + { + if (model == null) + { + return null; + } + using var context = new LawFirmDBContext(); + if (model.Id.HasValue) + { + return context.Cases.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; + } + return null; + } + public CaseViewModel? Insert(CaseBindingModel model) + { + using var context = new LawFirmDBContext(); + var newCase = Case.Create(context, model); + if (newCase != null) + { + context.Cases.Add(newCase); + context.SaveChanges(); + return newCase.GetViewModel; + } + return null; + } + public CaseViewModel? Update(CaseBindingModel model) + { + using var context = new LawFirmDBContext(); + var casee = context.Cases.FirstOrDefault(x => x.Id == model.Id); + if (casee == null) + { + return null; + } + casee.Update(context, model); + context.SaveChanges(); + return casee.GetViewModel; + } + public CaseViewModel? Delete(CaseBindingModel model) + { + using var context = new LawFirmDBContext(); + var casee = context.Cases.FirstOrDefault(x => x.Id == model.Id); + if (casee == null) + { + return null; + } + context.Cases.Remove(casee); + context.SaveChanges(); + return casee.GetViewModel; + } + } +} diff --git a/LawFirm/LawFirmDatabase/Implements/CustomerStorage.cs b/LawFirm/LawFirmDatabase/Implements/CustomerStorage.cs new file mode 100644 index 0000000..48b44ae --- /dev/null +++ b/LawFirm/LawFirmDatabase/Implements/CustomerStorage.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using LawFirmContracts.BindingModels; +using LawFirmContracts.SearchModels; +using LawFirmContracts.StorageContracts; +using LawFirmContracts.ViewModels; +using LawFirmDatabase.Models; + +namespace LawFirmDatabase.Implements +{ + public class CustomerStorage : ICustomerStorage + { + public List GetFullList() + { + using var context = new LawFirmDBContext(); + return context.Customers.Select(x => x.GetViewModel).ToList(); + } + public List GetFilteredList(CustomerSearchModel model) + { + using var context = new LawFirmDBContext(); + return context.Customers.Select(x => x.GetViewModel).Where(x => x.Id == model.Id).ToList(); + } + public CustomerViewModel? GetElement(CustomerSearchModel model) + { + using var context = new LawFirmDBContext(); + if (model.Id.HasValue) + { + return context.Customers.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; + } + else if (!string.IsNullOrEmpty(model.Login)) + { + return context.Customers.FirstOrDefault(x => x.Login == model.Login)?.GetViewModel; + } + return null; + } + public CustomerViewModel? Insert(CustomerBindingModel model) + { + using var context = new LawFirmDBContext(); + var newCustomer = Customer.Create(model); + if (newCustomer != null) + { + context.Customers.Add(newCustomer); + context.SaveChanges(); + return newCustomer.GetViewModel; + } + return null; + } + public CustomerViewModel? Update(CustomerBindingModel model) + { + using var context = new LawFirmDBContext(); + var customer = context.Customers.FirstOrDefault(x => x.Id == model.Id); + if (customer == null) + { + return null; + } + customer.Update(model); + context.SaveChanges(); + return customer.GetViewModel; + } + public CustomerViewModel? Delete(CustomerBindingModel model) + { + using var context = new LawFirmDBContext(); + var customer = context.Customers.FirstOrDefault(x => x.Id == model.Id); + if (customer == null) + { + return null; + } + context.Customers.Remove(customer); + context.SaveChanges(); + return customer.GetViewModel; + } + } +} diff --git a/LawFirm/LawFirmDatabase/Implements/ItemStorage.cs b/LawFirm/LawFirmDatabase/Implements/ItemStorage.cs new file mode 100644 index 0000000..7af399d --- /dev/null +++ b/LawFirm/LawFirmDatabase/Implements/ItemStorage.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using LawFirmContracts.BindingModels; +using LawFirmContracts.Models; +using LawFirmContracts.SearchModels; +using LawFirmContracts.StorageContracts; +using LawFirmContracts.ViewModels; +using LawFirmDatabase.Models; +using Microsoft.EntityFrameworkCore; + +namespace LawFirmDatabase.Implements +{ + public class ItemStorage : IItemStorage + { + public List GetFullList() + { + using var context = new LawFirmDBContext(); + return context.Items.Include(x => x.Services).Select(x => x.GetViewModel).ToList(); + } + public List GetFilteredList(ItemSearchModel model) + { + using var context = new LawFirmDBContext(); + return context.Items.Where(x => x.Id == model.Id).Include(x => x.Services).Select(x => x.GetViewModel).ToList(); + } + public ItemViewModel? GetElement(ItemSearchModel model) + { + if (model == null) + { + return null; + } + using var context = new LawFirmDBContext(); + if (model.Id.HasValue) + { + return context.Items.Include(x => x.Services).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; + } + if (!string.IsNullOrEmpty(model.Name)) + { + return context.Items.Include(x => x.Services).FirstOrDefault(x => x.Name == model.Name)?.GetViewModel; + } + return null; + } + public ItemViewModel? Insert(ItemBindingModel model) + { + using var context = new LawFirmDBContext(); + var newItem = Item.Create(context, model); + if (newItem != null) + { + context.Items.Add(newItem); + context.SaveChanges(); + return newItem.GetViewModel; + } + return null; + } + public ItemViewModel? Update(ItemBindingModel model) + { + using var context = new LawFirmDBContext(); + var item = context.Items.FirstOrDefault(x => x.Id == model.Id); + if (item == null) + { + return null; + } + item.Update(context, model); + context.SaveChanges(); + return item.GetViewModel; + } + public ItemViewModel? Delete(ItemBindingModel model) + { + using var context = new LawFirmDBContext(); + var item = context.Items.FirstOrDefault(x => x.Id == model.Id); + if (item == null) + { + return null; + } + context.Items.Remove(item); + context.SaveChanges(); + return item.GetViewModel; + } + } +} diff --git a/LawFirm/LawFirmDatabase/Implements/PaymentStorage.cs b/LawFirm/LawFirmDatabase/Implements/PaymentStorage.cs new file mode 100644 index 0000000..a4506bc --- /dev/null +++ b/LawFirm/LawFirmDatabase/Implements/PaymentStorage.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using LawFirmContracts.BindingModels; +using LawFirmContracts.Models; +using LawFirmContracts.SearchModels; +using LawFirmContracts.StorageContracts; +using LawFirmContracts.ViewModels; +using LawFirmDatabase.Models; + +namespace LawFirmDatabase.Implements +{ + public class PaymentStorage : IPaymentStorage + { + public List GetFullList() + { + using var context = new LawFirmDBContext(); + return context.Payments + .Select(x => x.GetViewModel) + .ToList(); + } + public List GetFilteredList(PaymentSearchModel model) + { + using var context = new LawFirmDBContext(); + return context.Payments + .Where(x => x.Id == model.Id) + .Select(x => x.GetViewModel) + .ToList(); + } + public PaymentViewModel? GetElement(PaymentSearchModel model) + { + if (model == null) + { + return null; + } + using var context = new LawFirmDBContext(); + if (model.Id.HasValue) + { + return context.Payments + .FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; + } + return null; + } + public PaymentViewModel? Insert(PaymentBindingModel model) + { + using var context = new LawFirmDBContext(); + var newPayment = Payment.Create(context, model); + if (newPayment != null) + { + context.Payments.Add(newPayment); + context.SaveChanges(); + return newPayment.GetViewModel; + } + return null; + } + public PaymentViewModel? Update(PaymentBindingModel model) + { + using var context = new LawFirmDBContext(); + var payment = context.Payments.FirstOrDefault(x => x.Id == model.Id); + if (payment == null) + { + return null; + } + payment.Update(context, model); + context.SaveChanges(); + return payment.GetViewModel; + } + public PaymentViewModel? Delete(PaymentBindingModel model) + { + using var context = new LawFirmDBContext(); + var payment = context.Payments.FirstOrDefault(x => x.Id == model.Id); + if (payment == null) + { + return null; + } + context.Payments.Remove(payment); + context.SaveChanges(); + return payment.GetViewModel; + } + } +} diff --git a/LawFirm/LawFirmDatabase/Implements/ServiceStorage.cs b/LawFirm/LawFirmDatabase/Implements/ServiceStorage.cs new file mode 100644 index 0000000..c54f7cb --- /dev/null +++ b/LawFirm/LawFirmDatabase/Implements/ServiceStorage.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using LawFirmContracts.BindingModels; +using LawFirmContracts.Models; +using LawFirmContracts.SearchModels; +using LawFirmContracts.StorageContracts; +using LawFirmContracts.ViewModels; +using LawFirmDatabase.Models; +using Microsoft.EntityFrameworkCore; + +namespace LawFirmDatabase.Implements +{ + public class ServiceStorage : IServiceStorage + { + public ServiceViewModel? Delete(ServiceBindingModel model) + { + using var context = new LawFirmDBContext(); + var service = context.Services.FirstOrDefault(x => x.Id == model.Id); + if (service == null) + { + return null; + } + context.Services.Remove(service); + context.SaveChanges(); + return service.GetViewModel; + } + + public ServiceViewModel? GetElement(ServiceSearchModel model) + { + if (model == null) + { + return null; + } + using var context = new LawFirmDBContext(); + if (model.Id.HasValue) + { + return context.Services + .FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; + } + return null; + } + + public List GetFilteredList(ServiceSearchModel model) + { + using var context = new LawFirmDBContext(); + return context.Services + .Where(x => x.Id == model.Id) + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFullList() + { + using var context = new LawFirmDBContext(); + return context.Services + .Select(x => x.GetViewModel) + .ToList(); + } + + public ServiceViewModel? Insert(ServiceBindingModel model) + { + using var context = new LawFirmDBContext(); + var newService = Service.Create(context, model); + if (newService != null) + { + context.Services.Add(newService); + context.SaveChanges(); + return newService.GetViewModel; + } + return null; + } + + public ServiceViewModel? Update(ServiceBindingModel model) + { + using var context = new LawFirmDBContext(); + var service = context.Services.FirstOrDefault(x => x.Id == model.Id); + if (service == null) + { + return null; + } + service.Update(context, model); + context.SaveChanges(); + return service.GetViewModel; + } + } +} diff --git a/LawFirm/LawFirmDatabase/Models/Case.cs b/LawFirm/LawFirmDatabase/Models/Case.cs index 665f55a..638535c 100644 --- a/LawFirm/LawFirmDatabase/Models/Case.cs +++ b/LawFirm/LawFirmDatabase/Models/Case.cs @@ -52,7 +52,7 @@ namespace LawFirmDatabase.Models Customer = context.Customers.First(x => x.Id == model.CustomerId); } - public CaseViewModel? GetViewModel() => new() + public CaseViewModel? GetViewModel => new() { Id = Id, Name = Name, diff --git a/LawFirm/LawFirmDatabase/Models/Customer.cs b/LawFirm/LawFirmDatabase/Models/Customer.cs index 381e2bb..de3aeef 100644 --- a/LawFirm/LawFirmDatabase/Models/Customer.cs +++ b/LawFirm/LawFirmDatabase/Models/Customer.cs @@ -54,13 +54,13 @@ namespace LawFirmDatabase.Models Surname = model.Surname; } - public CustomerViewModel? GetViewModel() => new() + public CustomerViewModel GetViewModel => new() { Id = Id, Login = Login, Password = Password, Name = Name, - Surname = Surname, + Surname = Surname }; } } diff --git a/LawFirm/LawFirmDatabase/Models/Payment.cs b/LawFirm/LawFirmDatabase/Models/Payment.cs index 7c411ce..8c5c6aa 100644 --- a/LawFirm/LawFirmDatabase/Models/Payment.cs +++ b/LawFirm/LawFirmDatabase/Models/Payment.cs @@ -53,7 +53,7 @@ namespace LawFirmDatabase.Models Cases = context.Cases.First(x => x.Id == model.CaseId); } - public PaymentViewModel? GetViewModel() => new() + public PaymentViewModel? GetViewModel => new() { Id = Id, Sum = Sum, diff --git a/LawFirm/LawFirmDatabase/Models/Service.cs b/LawFirm/LawFirmDatabase/Models/Service.cs index ab6ae0a..af2ddf1 100644 --- a/LawFirm/LawFirmDatabase/Models/Service.cs +++ b/LawFirm/LawFirmDatabase/Models/Service.cs @@ -54,7 +54,7 @@ namespace LawFirmDatabase.Models Cases = context.Cases.First(x => x.Id == model.CaseId); } - public ServiceViewModel? GetViewModel() => new() + public ServiceViewModel? GetViewModel => new() { Id = Id, Name = Name,