еще куча
This commit is contained in:
parent
0365a4074f
commit
7fa4aecdd7
@ -1,8 +1,11 @@
|
||||
using ClientApp.Models;
|
||||
using BeautySalonContracts.BindingModels;
|
||||
using BeautySalonContracts.ViewModels;
|
||||
using BeutySalonClientApp.Models;
|
||||
using BeutySalonClientApp;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ClientApp.Controllers
|
||||
namespace BeutySalonClientApp.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
@ -13,12 +16,142 @@ namespace ClientApp.Controllers
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIClient.Client = APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
public IActionResult Procedure(int page)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if (page == 0)
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
ViewBag.Procedure = APIClient.GetRequest<List<ProcedureViewModel>>
|
||||
($"api/procedure/getmany?userId={APIClient.Client.Id}&page={page}");
|
||||
ViewBag.Page = page;
|
||||
ViewBag.NumberOfPages = APIClient.GetRequest<int>
|
||||
($"api/procedure/getnumberofpages?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Register(string login, string fio, string password, string email)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(fio) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/client/register", new ClientBindingModel
|
||||
{
|
||||
ClientLogin = login,
|
||||
ClientFIO = fio,
|
||||
ClientEmail = email,
|
||||
ClientPassword = password
|
||||
});
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
|
||||
public IActionResult Order(int page)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if (page == 0)
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
ViewBag.Order = APIClient.GetRequest<List<OrderViewModel>>
|
||||
($"api/order/getmany?userId={APIClient.Client.Id}&page={page}");
|
||||
ViewBag.Page = page;
|
||||
ViewBag.NumberOfPages = APIClient.GetRequest<int>
|
||||
($"api/order/getnumberofpages?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Evaluation(int page)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if (page == 0)
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
ViewBag.Rating = APIClient.GetRequest<List<EvaluationViewModel>>
|
||||
($"api/rating/getmany?userId={APIClient.Client.Id}&page={page}");
|
||||
ViewBag.Page = page;
|
||||
ViewBag.NumberOfPages = APIClient.GetRequest<int>
|
||||
($"api/rating/getnumberofpages?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult FormationOrder()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult FormingAnRating()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult LinkingProceduresForSelectedOrders()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult ServiceList()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.IsAllowed = true;
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
public IActionResult OrderFormationAccordingProcedures()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Report()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
@ -28,5 +161,6 @@ namespace ClientApp.Controllers
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,83 +1,96 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using BeautySalonContracts.BindingModels;
|
||||
using BeautySalonContracts.ViewModels;
|
||||
using BeutySalonClientApp;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ClientApp.Controllers
|
||||
namespace BeutySalonClientApp.Controllers
|
||||
{
|
||||
public class OrderController : Controller
|
||||
{
|
||||
// GET: OrderController
|
||||
public ActionResult Index()
|
||||
public IActionResult Create()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
// GET: OrderController/Details/5
|
||||
public ActionResult Details(int id)
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// GET: OrderController/Create
|
||||
public ActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: OrderController/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Create(IFormCollection collection)
|
||||
public void Create([FromBody] OrderBindingModel orderModel)
|
||||
{
|
||||
try
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return View();
|
||||
throw new Exception("403");
|
||||
}
|
||||
orderModel.ClientId = APIClient.Client.Id;
|
||||
APIClient.PostRequest("api/order/create", orderModel);
|
||||
}
|
||||
|
||||
// GET: OrderController/Edit/5
|
||||
public ActionResult Edit(int id)
|
||||
public IActionResult Update(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Id = id;
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: OrderController/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Edit(int id, IFormCollection collection)
|
||||
public void Update([FromBody] OrderBindingModel orderModel)
|
||||
{
|
||||
try
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return View();
|
||||
throw new Exception("403");
|
||||
}
|
||||
orderModel.ClientId = APIClient.Client.Id;
|
||||
APIClient.PostRequest("api/order/update", orderModel);
|
||||
}
|
||||
|
||||
// GET: OrderController/Delete/5
|
||||
public ActionResult Delete(int id)
|
||||
[HttpPost]
|
||||
public void Delete(int id)
|
||||
{
|
||||
return View();
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
APIClient.PostRequest($"api/order/delete",
|
||||
new OrderBindingModel() { Id = id });
|
||||
return;
|
||||
}
|
||||
|
||||
// POST: OrderController/Delete/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Delete(int id, IFormCollection collection)
|
||||
[HttpGet]
|
||||
public List<ServiceViewModel>? GetAllServices()
|
||||
{
|
||||
try
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return RedirectToAction(nameof(Index));
|
||||
throw new Exception("403");
|
||||
}
|
||||
catch
|
||||
var services = APIClient.GetRequest<List<ServiceViewModel>>($"api/service/getall");
|
||||
return services;
|
||||
}
|
||||
|
||||
public OrderViewModel? Get(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return View();
|
||||
return new();
|
||||
}
|
||||
OrderViewModel? order = APIClient
|
||||
.GetRequest<OrderViewModel>($"api/order/get?id={id}");
|
||||
return order;
|
||||
}
|
||||
|
||||
public List<OrderViewModel>? GetAllByUser()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
List<OrderViewModel>? order = APIClient
|
||||
.GetRequest<List<OrderViewModel>>($"api/order/GetAllByUser?userId={APIClient.Client.Id}");
|
||||
return order;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,83 +1,96 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using BeautySalonContracts.BindingModels;
|
||||
using BeautySalonContracts.ViewModels;
|
||||
using BeutySalonClientApp;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ClientApp.Controllers
|
||||
namespace BeutySalonClientApp.Controllers
|
||||
{
|
||||
public class ProcedureController : Controller
|
||||
{
|
||||
// GET: ProcedureController
|
||||
public ActionResult Index()
|
||||
public IActionResult Create()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
// GET: ProcedureController/Details/5
|
||||
public ActionResult Details(int id)
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// GET: ProcedureController/Create
|
||||
public ActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: ProcedureController/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Create(IFormCollection collection)
|
||||
public void Create([FromBody] ProcedureBindingModel procedureModel)
|
||||
{
|
||||
try
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return View();
|
||||
throw new Exception("403");
|
||||
}
|
||||
procedureModel.ClientId = APIClient.Client.Id;
|
||||
APIClient.PostRequest("api/procedure/create", procedureModel);
|
||||
}
|
||||
|
||||
// GET: ProcedureController/Edit/5
|
||||
public ActionResult Edit(int id)
|
||||
public IActionResult Update(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Id = id;
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: ProcedureController/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Edit(int id, IFormCollection collection)
|
||||
public void Update([FromBody] ProcedureBindingModel procedureModel)
|
||||
{
|
||||
try
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return View();
|
||||
throw new Exception("403");
|
||||
}
|
||||
procedureModel.ClientId = APIClient.Client.Id;
|
||||
APIClient.PostRequest("api/procedure/update", procedureModel);
|
||||
}
|
||||
|
||||
// GET: ProcedureController/Delete/5
|
||||
public ActionResult Delete(int id)
|
||||
[HttpPost]
|
||||
public void Delete(int id)
|
||||
{
|
||||
return View();
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
APIClient.PostRequest($"api/procedure/delete",
|
||||
new ProcedureBindingModel() { Id = id });
|
||||
return;
|
||||
}
|
||||
|
||||
// POST: ProcedureController/Delete/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Delete(int id, IFormCollection collection)
|
||||
[HttpGet]
|
||||
public List<CosmeticViewModel>? GetAllCosmetics()
|
||||
{
|
||||
try
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return RedirectToAction(nameof(Index));
|
||||
throw new Exception("403");
|
||||
}
|
||||
catch
|
||||
var cosmetics = APIClient.GetRequest<List<CosmeticViewModel>>($"api/cosmetic/getall");
|
||||
return cosmetics;
|
||||
}
|
||||
|
||||
public ProcedureViewModel? Get(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return View();
|
||||
return new();
|
||||
}
|
||||
ProcedureViewModel? procedure = APIClient
|
||||
.GetRequest<ProcedureViewModel>($"api/procedure/get?id={id}");
|
||||
return procedure;
|
||||
}
|
||||
|
||||
public List<ProcedureViewModel>? GetAllByUser()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
List<ProcedureViewModel>? procedures = APIClient.GetRequest<List<ProcedureViewModel>>
|
||||
($"api/procedure/getallbyuser?userId={APIClient.Client.Id}");
|
||||
return procedures;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace ClientApp.Models
|
||||
namespace BeutySalonClientApp.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
@ -6,4 +6,4 @@ namespace ClientApp.Models
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
using BeutySalonClientApp;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
APIClient.Connect(builder.Configuration);
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
ViewData["Title"] = "HomePage";
|
||||
}
|
||||
<h1 class="display-4 text-center">Мы Вас не ждали, зло пожаловать!</h1>
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
||||
<p><img src="/images/logo.png" alt="Logo" /></p>
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user