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

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