Nevaeva K. A. LabWork#5 Base #5

Closed
ksenia_nevaeva wants to merge 6 commits from lab5_base into lab4_base
Showing only changes of commit 1eea7331e4 - Show all commits

View File

@ -1,12 +1,12 @@
using TravelCompanyContracts.BindingModels;
using TravelCompanyContracts.ViewModels;
using TravelCompanyClientApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using TravelCompanyClientApp;
using Microsoft.AspNetCore.Mvc;
using PrecastConcretePlantClientApp;
using System.Diagnostics;
using TravelCompanyClientApp.Models;
using TravelCompanyContracts.BindingModels;
using TravelCompanyContracts.ViewModels;
namespace TravelCompanyClientApp.Controllers
namespace AbstractShowClientApp.Controllers
{
public class HomeController : Controller
{
@ -76,7 +76,8 @@ namespace TravelCompanyClientApp.Controllers
[HttpPost]
public void Enter(string login, string password)
{
if (string.IsNullOrEmpty(login) ||string.IsNullOrEmpty(password))
if (string.IsNullOrEmpty(login) ||
string.IsNullOrEmpty(password))
{
throw new Exception("Введите логин и пароль");
}
@ -101,7 +102,8 @@ namespace TravelCompanyClientApp.Controllers
{
throw new Exception("Введите логин, пароль и ФИО");
}
APIClient.PostRequest("api/client/register", new ClientBindingModel
APIClient.PostRequest("api/client/register", new
ClientBindingModel
{
ClientFIO = fio,
Email = login,
@ -114,7 +116,7 @@ namespace TravelCompanyClientApp.Controllers
public IActionResult Create()
{
ViewBag.Products =
APIClient.GetRequest<List<TravelViewModel>>("api/main/gettravellist");
APIClient.GetRequest<List<TravelViewModel>>("api/main/getproductlist");
return View();
}
[HttpPost]
@ -142,7 +144,7 @@ namespace TravelCompanyClientApp.Controllers
public double Calc(int count, int travel)
{
var prod =
APIClient.GetRequest<TravelViewModel>($"api/main/gettravel?travelId={travel}"
APIClient.GetRequest<TravelViewModel>($"api/main/getproduct?travelId={travel}"
);
return count * (prod?.Price ?? 1);
}