Этот комит, который комит смогшей найти ошибку

This commit is contained in:
Кашин Максим 2023-05-03 22:48:06 +04:00
parent 53dce1b1d9
commit 24b50c4b38

View File

@ -10,10 +10,12 @@ namespace PrecastConcretePlantClientApp.Controllers
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
if (APIClient.Client == null)
@ -22,6 +24,7 @@ namespace PrecastConcretePlantClientApp.Controllers
}
return View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
}
[HttpGet]
public IActionResult Privacy()
{
@ -31,6 +34,7 @@ namespace PrecastConcretePlantClientApp.Controllers
}
return View(APIClient.Client);
}
[HttpPost]
public void Privacy(string login, string password, string fio)
{
@ -42,32 +46,32 @@ namespace PrecastConcretePlantClientApp.Controllers
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIClient.PostRequest("api/client/updatedata", new
ClientBindingModel
APIClient.PostRequest("api/client/updatedata", new ClientBindingModel
{
Id = APIClient.Client.Id,
ClientFIO = fio,
Email = login,
Password = password
});
APIClient.Client.ClientFIO = fio;
APIClient.Client.Email = login;
APIClient.Client.Password = password;
Response.Redirect("Index");
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier
});
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
[HttpGet]
public IActionResult Enter()
{
return View();
}
[HttpPost]
public void Enter(string login, string password)
{
@ -82,11 +86,13 @@ namespace PrecastConcretePlantClientApp.Controllers
}
Response.Redirect("Index");
}
[HttpGet]
public IActionResult Register()
{
return View();
}
[HttpPost]
public void Register(string login, string password, string fio)
{
@ -103,12 +109,14 @@ namespace PrecastConcretePlantClientApp.Controllers
Response.Redirect("Enter");
return;
}
[HttpGet]
public IActionResult Create()
{
ViewBag.Reinforcedies = APIClient.GetRequest<List<ReinforcedViewModel>>("api/main/getreinforcedlist");
return View();
}
[HttpPost]
public void Create(int reinforced, int count)
{
@ -129,11 +137,12 @@ namespace PrecastConcretePlantClientApp.Controllers
});
Response.Redirect("Index");
}
[HttpPost]
public double Calc(int count, int reinforced)
{
var doc = APIClient.GetRequest<ReinforcedViewModel>($"api/main/getreinforced?reinforcedId={reinforced}");
return count * (doc?.Price ?? 1);
var prod = APIClient.GetRequest<ReinforcedViewModel>($"api/main/getreinforced?reinforcedId={reinforced}");
return count * (prod?.Price ?? 1);
}
[HttpGet]
@ -143,7 +152,7 @@ namespace PrecastConcretePlantClientApp.Controllers
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
return View();
}
[HttpGet]