ОБНОВЛЕНИЕ РАБОТАЕТ

This commit is contained in:
dasha 2023-03-30 00:23:51 +04:00
parent 231063ed16
commit 1d8fc2ccac
4 changed files with 22 additions and 13 deletions

View File

@ -42,21 +42,25 @@ namespace BeautySaloonDatabaseImplement.Implements
public List<EmployeeViewModel> GetFilteredList(EmployeeSearchModel model)
{
using var context = new NewdbContext();
if (string.IsNullOrEmpty(model.Surname) && !model.Id.HasValue)
{
return new();
}
if (model.Id.HasValue)
return context.Employees
.Include(x => x.Position)
.Where(x => x.Id.Equals(model.Id))
.Select(x => x.GetViewModel)
.ToList();
return context.Employees
.Include(x => x.Position)
.Where(x => x.Surname.Contains(model.Surname))
.Select(x => x.GetViewModel)
.ToList();
if (model.PositionId.HasValue)
return context.Employees
.Include(x => x.Position)
.Where(x => x.PositionId.Equals(model.PositionId))
.Select(x => x.GetViewModel)
.ToList();
if (!string.IsNullOrEmpty(model.Surname))
return context.Employees
.Include(x => x.Position)
.Where(x => x.Surname.Contains(model.Surname))
.Select(x => x.GetViewModel)
.ToList();
return new();
}
public List<EmployeeViewModel> GetFullList()

View File

@ -14,6 +14,8 @@ namespace BeautySaloonDatabaseImplement.Implements
var element = context.Orders
.Include(x => x.Employee)
.Include(x => x.Client)
.Include(x => x.ServiceOrders)
.ThenInclude(x => x.Service)
.FirstOrDefault(rec => rec.Id == model.Id);
if (element != null)
{
@ -29,8 +31,10 @@ namespace BeautySaloonDatabaseImplement.Implements
using var context = new NewdbContext();
if (model.Id.HasValue)
return context.Orders
.Include(x => x.Employee)
.Include(x => x.Client)
.Include(x => x.Employee)
.Include(x => x.ServiceOrders)
.ThenInclude(x => x.Service)
.FirstOrDefault(x => x.Id == model.Id)?
.GetViewModel;
return null;

View File

@ -97,7 +97,8 @@ public partial class Order : IOrderModel
ClientName = Client.Name + " " + Client.Surname + " " + Client.Patronymic,
EmployeeName = Employee.Name + " " + Employee.Surname + " " + Employee.Patronymic,
ClientPhone = Client.Phone,
EmployeePhone = Employee.Phone
EmployeePhone = Employee.Phone,
OrderServices = OrderServices
};
public void UpdateServices(NewdbContext context, OrderBindingModel model)

View File

@ -28,7 +28,7 @@ namespace BeautySaloonView
// продавцы
var list = _logicE.ReadList(new EmployeeSearchModel
{
Id = 1
PositionId = 1
});
if (list != null)
{
@ -42,7 +42,7 @@ namespace BeautySaloonView
{
var view = _logicO.ReadElement(new OrderSearchModel
{
Id = _idClient.Value
Id = _id
});
if (view != null)
{