fix filtration
This commit is contained in:
parent
f4dd73833d
commit
d617260cb3
@ -26,7 +26,7 @@ namespace CarShowroomDatabaseStorage.Storages
|
||||
|
||||
public List<CarView> GetFilteredList(CarSearch model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
if (!model.Id.HasValue && !model.IsSaled.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ namespace CarShowroomDatabaseStorage.Storages
|
||||
var newSale = Sale.Create(model);
|
||||
if (newSale == null)
|
||||
throw new InvalidOperationException("SaleId is incorrect");
|
||||
int saleId = context.Sales.Add(newSale).CurrentValues.GetValue<int>("Id");
|
||||
context.SaveChanges();
|
||||
int saleId = context.Sales.Add(newSale).CurrentValues.GetValue<int>("Id");
|
||||
SaleView result = UpdateCarsAndServices(context, model, saleId);
|
||||
transaction.Commit();
|
||||
return result;
|
||||
|
@ -80,27 +80,22 @@ namespace CarShowroomManagerApp.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
//[HttpPost]
|
||||
//public void SaleCreate(int manufacture, int count)
|
||||
//{
|
||||
// if (APIClient.Client == null)
|
||||
// {
|
||||
// throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
// }
|
||||
// if (count <= 0)
|
||||
// {
|
||||
// throw new Exception("Количество и сумма должны быть больше 0");
|
||||
// }
|
||||
// APIClient.PostRequest("api/main/createorder", new
|
||||
// OrderBindingModel
|
||||
// {
|
||||
// ClientId = APIClient.Client.Id,
|
||||
// ManufactureId = manufacture,
|
||||
// Count = count,
|
||||
// Sum = Calc(count, manufacture)
|
||||
// });
|
||||
// Response.Redirect("Index");
|
||||
//}
|
||||
[HttpPost]
|
||||
public void SaleCreate(int client, List<int> cars, List<int> services)
|
||||
{
|
||||
if (ApiClient.Client == null)
|
||||
{
|
||||
Redirect("~/Home/Enter");
|
||||
}
|
||||
ApiClient.PostRequest("api/sale/createsale", new
|
||||
SaleDto
|
||||
{
|
||||
ClientId = client,
|
||||
CarIds = cars,
|
||||
ServiceIds = services
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
public IActionResult ClientCreate()
|
||||
{
|
||||
@ -137,7 +132,7 @@ namespace CarShowroomManagerApp.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void ClientUpdate(string phonenumber, string name)
|
||||
public void ClientUpdate(int client, string phonenumber, string name)
|
||||
{
|
||||
if (ApiClient.Client == null)
|
||||
{
|
||||
@ -150,7 +145,7 @@ namespace CarShowroomManagerApp.Controllers
|
||||
}
|
||||
ApiClient.PostRequest("api/client/updateclient", new ClientDto
|
||||
{
|
||||
Id = ApiClient.Client.Id,
|
||||
Id = client,
|
||||
Name = name,
|
||||
PhoneNumber = phonenumber
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user