исправление ошибок

This commit is contained in:
spacyboy 2024-04-29 22:05:27 +04:00
parent cf0cfe3178
commit bb202799f6

View File

@ -295,22 +295,22 @@ namespace CarCenterRestApi.Controllers
}
}
[HttpGet]
public Tuple<EmployeeViewModel, List<Tuple<string, string>>>? GetEmployee(int employeeId)
{
try
{
var elem = _employee.ReadElement(new EmployeeSearchModel { Id = employeeId });
if (elem == null)
return null;
return Tuple.Create(elem, elem.EmployeeSales.Select(x => Tuple.Create(x.Value.SaleDate, x.Value.SalePrice)).ToList());
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения сотрудника по id={Id}", employeeId);
throw;
}
}
//[HttpGet]
//public Tuple<EmployeeViewModel, List<Tuple<DateTime, double>>>? GetEmployee(int employeeId)
//{
// try
// {
// var elem = _employee.ReadElement(new EmployeeSearchModel { Id = employeeId });
// if (elem == null)
// return null;
// return Tuple.Create(elem, elem.EmployeeSales.Select(x => Tuple.Create(x.Value.SaleDate, x.Value.SalePrice)).ToList());
// }
// catch (Exception ex)
// {
// _logger.LogError(ex, "Ошибка получения сотрудника по id={Id}", employeeId);
// throw;
// }
//}
[HttpPost]
public void DeleteEmployee(EmployeeBindingModel model)
@ -369,23 +369,23 @@ namespace CarCenterRestApi.Controllers
}
}
[HttpGet]
public Tuple<PreSaleWorkViewModel, List<Tuple<string, string>>, List<Tuple<string, string>>>? GetPreSaleWork(int preSaleWorkId)
{
try
{
using var context = new CarCenterDataBase();
var elem = _preSaleWork.ReadElement(new PreSaleWorkSearchModel { Id = preSaleWorkId });
if (elem == null)
return null;
return Tuple.Create(elem, elem.PreSaleWorkSales.Select(x => Tuple.Create(x.Value.SaleDate, x.Value.SalePrice)).ToList(), context.Equipments.Where(x => x.PreSaleWorkId == elem.Id).Select(x => Tuple.Create(x.EquipmentName, x.EquipmentPrice)).ToList());
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения препродажной работы по id={Id}", preSaleWorkId);
throw;
}
}
//[HttpGet]
//public Tuple<PreSaleWorkViewModel, List<Tuple<DateTime, double>>, List<Tuple<string, string>>>? GetPreSaleWork(int preSaleWorkId)
//{
// try
// {
// using var context = new CarCenterDataBase();
// var elem = _preSaleWork.ReadElement(new PreSaleWorkSearchModel { Id = preSaleWorkId });
// if (elem == null)
// return null;
// return Tuple.Create(elem, elem.PreSaleWorkSales.Select(x => Tuple.Create(x.Value.SaleDate, x.Value.SalePrice)).ToList(), context.Equipments.Where(x => x.PreSaleWorkId == elem.Id).Select(x => Tuple.Create(x.EquipmentName, x.EquipmentPrice)).ToList());
// }
// catch (Exception ex)
// {
// _logger.LogError(ex, "Ошибка получения препродажной работы по id={Id}", preSaleWorkId);
// throw;
// }
//}
[HttpPost]
public void DeletePreSaleWork(PreSaleWorkBindingModel model)