Всё работает

This commit is contained in:
Yunusov_Niyaz 2024-05-21 18:55:09 +04:00
parent f11e568b69
commit 702ae6d967
8 changed files with 10 additions and 30 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace CarRepairShopDatabaseImplement.Migrations
{
[DbContext(typeof(RepairsShopDatabase))]
[Migration("20240520225652_InitialCreate")]
[Migration("20240521131556_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />

View File

@ -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,

View File

@ -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,

View File

@ -39,14 +39,16 @@ namespace CarRepairShopRestApi.Controllers
}
}
[HttpGet]
public List<MessageInfoViewModel>? GetMessages(int clientId)
public List<MessageInfoViewModel>? 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<MessageInfoViewModel>? 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;
}
}
}
}

View File

@ -27,7 +27,7 @@
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Mails">Письма</a>
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Mails" asp-route-page="1">Письма</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Вход</a>