diff --git a/CarRepairShop/CarRepairShop/FormMain.cs b/CarRepairShop/CarRepairShop/FormMain.cs index 032407d..6ce6528 100644 --- a/CarRepairShop/CarRepairShop/FormMain.cs +++ b/CarRepairShop/CarRepairShop/FormMain.cs @@ -34,7 +34,6 @@ namespace CarRepairShop dataGridView.DataSource = list; dataGridView.Columns["RepairId"].Visible = false; dataGridView.Columns["ClientId"].Visible = false; - dataGridView.Columns["ClientEmail"].Visible = false; dataGridView.Columns["ImplementerId"].Visible = false; dataGridView.Columns["RepairName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } diff --git a/CarRepairShop/CarRepairShopContracts/ViewModels/OrderViewModel.cs b/CarRepairShop/CarRepairShopContracts/ViewModels/OrderViewModel.cs index 4ab9fa8..7cddd0b 100644 --- a/CarRepairShop/CarRepairShopContracts/ViewModels/OrderViewModel.cs +++ b/CarRepairShop/CarRepairShopContracts/ViewModels/OrderViewModel.cs @@ -15,7 +15,6 @@ namespace CarRepairShopContracts.ViewModels public int ClientId { get; set; } [DisplayName("Клиент")] public string ClientFIO { get; set; } = string.Empty; - public string ClientEmail { get; set; } = string.Empty; public int? ImplementerId { get; set; } = null; [DisplayName("Исполнитель")] public string ImplementerFIO { get; set; } = string.Empty; diff --git a/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240520225652_InitialCreate.Designer.cs b/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240521131556_InitialCreate.Designer.cs similarity index 99% rename from CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240520225652_InitialCreate.Designer.cs rename to CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240521131556_InitialCreate.Designer.cs index a2937a9..ab41ec4 100644 --- a/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240520225652_InitialCreate.Designer.cs +++ b/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240521131556_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace CarRepairShopDatabaseImplement.Migrations { [DbContext(typeof(RepairsShopDatabase))] - [Migration("20240520225652_InitialCreate")] + [Migration("20240521131556_InitialCreate")] partial class InitialCreate { /// diff --git a/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240520225652_InitialCreate.cs b/CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240521131556_InitialCreate.cs similarity index 100% rename from CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240520225652_InitialCreate.cs rename to CarRepairShop/CarRepairShopDatabaseImplement/Migrations/20240521131556_InitialCreate.cs diff --git a/CarRepairShop/CarRepairShopDatabaseImplement/Models/MessageInfo.cs b/CarRepairShop/CarRepairShopDatabaseImplement/Models/MessageInfo.cs index 9f181d4..0cedce0 100644 --- a/CarRepairShop/CarRepairShopDatabaseImplement/Models/MessageInfo.cs +++ b/CarRepairShop/CarRepairShopDatabaseImplement/Models/MessageInfo.cs @@ -36,8 +36,7 @@ namespace CarRepairShopDatabaseImplement.Models { Body = model.Body, Subject = model.Subject, - ClientId = context.Clients.FirstOrDefault(x => x.Email == model.SenderName).Id, - Client = context.Clients.FirstOrDefault(x => x.Email == model.SenderName), + ClientId = context.Clients.FirstOrDefault(x => x.Email == model.SenderName)?.Id, MessageId = model.MessageId, SenderName = model.SenderName, DateDelivery = model.DateDelivery, diff --git a/CarRepairShop/CarRepairShopDatabaseImplement/Models/Order.cs b/CarRepairShop/CarRepairShopDatabaseImplement/Models/Order.cs index 79454c0..776a649 100644 --- a/CarRepairShop/CarRepairShopDatabaseImplement/Models/Order.cs +++ b/CarRepairShop/CarRepairShopDatabaseImplement/Models/Order.cs @@ -60,7 +60,6 @@ namespace CarRepairShopDatabaseImplement.Models ImplementerId = ImplementerId, RepairName = Repair?.RepairName ?? string.Empty, ClientFIO = Client?.ClientFIO ?? string.Empty, - ClientEmail = Client.Email, Count = Count, Sum = Sum, Status = Status, diff --git a/CarRepairShop/CarRepairShopRestApi/Controllers/ClientController.cs b/CarRepairShop/CarRepairShopRestApi/Controllers/ClientController.cs index 2aafd99..8ca848d 100644 --- a/CarRepairShop/CarRepairShopRestApi/Controllers/ClientController.cs +++ b/CarRepairShop/CarRepairShopRestApi/Controllers/ClientController.cs @@ -39,14 +39,16 @@ namespace CarRepairShopRestApi.Controllers } } [HttpGet] - public List? GetMessages(int clientId) + public List? GetMessages(int clientId, int page, int pagesize = 1) { try { return _mailLogic.ReadList(new MessageInfoSearchModel { - ClientId = clientId - }); + ClientId = clientId, + PageLength = pagesize, + PageIndex = page + }); } catch (Exception ex) { @@ -64,8 +66,8 @@ namespace CarRepairShopRestApi.Controllers catch (Exception ex) { _logger.LogError(ex, "Ошибка регистрации"); - Response.StatusCode = (int)HttpStatusCode.NotAcceptable; - } + Response.StatusCode = (int)HttpStatusCode.NotAcceptable; + } } [HttpPost] public void UpdateData(ClientBindingModel model) @@ -80,23 +82,5 @@ namespace CarRepairShopRestApi.Controllers throw; } } - [HttpGet] - public List? GetMessages(int clientId, int page, int pagesize = 1) - { - try - { - return _mailLogic.ReadList(new MessageInfoSearchModel - { - ClientId = clientId, - PageLength = pagesize, - PageIndex = page - }); - } - catch (Exception ex) - { - _logger.LogError(ex, "Ошибка получения писем клиента"); - throw; - } - } } } diff --git a/CarRepairShop/CarRepairShowClientApp/Views/Shared/_Layout.cshtml b/CarRepairShop/CarRepairShowClientApp/Views/Shared/_Layout.cshtml index 699497d..6ef3ae3 100644 --- a/CarRepairShop/CarRepairShowClientApp/Views/Shared/_Layout.cshtml +++ b/CarRepairShop/CarRepairShowClientApp/Views/Shared/_Layout.cshtml @@ -27,7 +27,7 @@ Личные данные