Nevaeva K. A. LabWork#5 Base #5
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user