большие проблемы на маленькой кухне
This commit is contained in:
parent
91a12c6001
commit
9e697d189d
@ -23,14 +23,14 @@ namespace BeutySalonClientApp.Controllers
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIClient.PostRequest("api/rating/create", new EvaluationBindingModel
|
||||
APIClient.PostRequest("api/evaluation/create", new EvaluationBindingModel
|
||||
{
|
||||
ClientId = APIClient.Client.Id,
|
||||
PointsProcedure = double.Parse(pointsProcedure.Replace(".", ",")),
|
||||
PointsCosmetics = double.Parse(pointsCosmetics.Replace(".", ",")),
|
||||
ProcedureId = procedureId
|
||||
});
|
||||
Response.Redirect("/Home/Rating");
|
||||
Response.Redirect("/Home/Evaluation");
|
||||
}
|
||||
|
||||
public IActionResult Update(int id)
|
||||
@ -39,8 +39,8 @@ namespace BeutySalonClientApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Rating = APIClient.GetRequest<EvaluationBindingModel>
|
||||
($"api/rating/get?id={id}");
|
||||
ViewBag.Evaluation = APIClient.GetRequest<EvaluationBindingModel>
|
||||
($"api/evaluation/get?id={id}");
|
||||
ViewBag.Procedure = APIClient.GetRequest<List<ProcedureViewModel>>($"api/procedure/getall?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
@ -52,14 +52,14 @@ namespace BeutySalonClientApp.Controllers
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIClient.PostRequest("api/rating/update", new EvaluationBindingModel
|
||||
APIClient.PostRequest("api/evaluation/update", new EvaluationBindingModel
|
||||
{
|
||||
Id = id,
|
||||
PointsProcedure = double.Parse(pointsProcedure.Replace(".", ",")),
|
||||
PointsCosmetics = double.Parse(pointsCosmetics.Replace(".", ",")),
|
||||
ProcedureId = procedureId
|
||||
});
|
||||
Response.Redirect("/Home/Rating");
|
||||
Response.Redirect("/Home/Evaluation");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@ -69,7 +69,7 @@ namespace BeutySalonClientApp.Controllers
|
||||
{
|
||||
return;
|
||||
}
|
||||
APIClient.PostRequest($"api/rating/delete",
|
||||
APIClient.PostRequest($"api/evaluation/delete",
|
||||
new ServiceBindingModel() { Id = id });
|
||||
return;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ namespace BeutySalonClientApp.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Rating(int page)
|
||||
public IActionResult Evaluation(int page)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
@ -104,11 +104,11 @@ namespace BeutySalonClientApp.Controllers
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
ViewBag.Rating = APIClient.GetRequest<List<RatingViewModel>>
|
||||
($"api/rating/getmany?userId={APIClient.Client.Id}&page={page}");
|
||||
ViewBag.Evaluation = APIClient.GetRequest<List<EvaluationViewModel>>
|
||||
($"api/evaluation/getmany?userId={APIClient.Client.Id}&page={page}");
|
||||
ViewBag.Page = page;
|
||||
ViewBag.NumberOfPages = APIClient.GetRequest<int>
|
||||
($"api/rating/getnumberofpages?userId={APIClient.Client.Id}");
|
||||
($"api/evaluation/getnumberofpages?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ namespace BeutySalonClientApp.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult FormingAnRating()
|
||||
public IActionResult FormingAnEvaluation()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
@ -174,30 +174,15 @@ namespace BeutySalonClientApp.Controllers
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public List<ReportOrdersViewModel>? Report([FromBody] ReportClientBindingModel reportModel)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
reportModel.ClientId = APIClient.Client.Id;
|
||||
List<ReportOrderServicesViewModel>? list = APIClient.PostRequestWithResult
|
||||
<ReportClientBindingModel, List<ReportOrderServicesViewModel>>
|
||||
("api/report/GetOrdersReportData", reportModel);
|
||||
return list;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void SendByMailReport([FromBody] ReportClientBindingModel reportModel)
|
||||
[HttpGet]
|
||||
public IActionResult Mails()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return;
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
reportModel.ClientId = APIClient.Client.Id;
|
||||
reportModel.ClientEmail = APIClient.Client.ClientEmail;
|
||||
APIClient.PostRequest("api/report/sendbymailordersreport", reportModel);
|
||||
return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
|
||||
}
|
||||
}
|
||||
}
|
67
BeautySalonView/StaffMemberWebApp/APIClient.cs
Normal file
67
BeautySalonView/StaffMemberWebApp/APIClient.cs
Normal file
@ -0,0 +1,67 @@
|
||||
using BeautySalonContracts.ViewModels;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace BeutySalonStaffMemberApp
|
||||
{
|
||||
public class APIClient
|
||||
{
|
||||
private static readonly HttpClient _client = new();
|
||||
|
||||
public static StaffMemberViewModel? Client { get; set; } = null;
|
||||
|
||||
public static void Connect(IConfiguration configuration)
|
||||
{
|
||||
_client.BaseAddress = new Uri(configuration["IPAddress"]!);
|
||||
_client.DefaultRequestHeaders.Accept.Clear();
|
||||
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
{
|
||||
var response = _client.GetAsync(requestUrl);
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PostRequest<T>(string requestUrl, T model)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(model);
|
||||
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = _client.PostAsync(requestUrl, data);
|
||||
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (!response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception(result);
|
||||
}
|
||||
}
|
||||
|
||||
public static O? PostRequestWithResult<I, O>(string requestUrl, I model)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(model);
|
||||
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = _client.PostAsync(requestUrl, data);
|
||||
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
if (response.Result.IsSuccessStatusCode)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<O>(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
using BeautySalonContracts.BindingModels;
|
||||
using BeautySalonContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BeutySalonStaffMemberApp.Controllers
|
||||
{
|
||||
public class CosmeticController : Controller
|
||||
{
|
||||
public IActionResult Create()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Create(string brand, string cosmeticName, string cosmeticPrice)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIClient.PostRequest("api/cosmetic/create", new CosmeticBindingModel
|
||||
{
|
||||
StaffMemberId = APIClient.Client.Id,
|
||||
Brand = brand,
|
||||
CosmeticName = cosmeticName,
|
||||
CosmeticPrice = double.Parse(cosmeticPrice.Replace(".", ","))
|
||||
|
||||
});
|
||||
Response.Redirect("/Home/Cosmetic");
|
||||
}
|
||||
|
||||
public IActionResult Update(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Service = APIClient.GetRequest<ServiceBindingModel>
|
||||
($"api/service/get?id={id}");
|
||||
ViewBag.Procedure = APIClient.GetRequest<ProcedureBindingModel>
|
||||
($"api/procedure/get?id={id}");
|
||||
ViewBag.Cosmetic = APIClient.GetRequest<List<LaborCostsViewModel>>
|
||||
($"api/cosmetic/getall?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Update(int id, string brand, string cosmeticName, string cosmeticPrice)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIClient.PostRequest("api/cosmetic/update", new CosmeticBindingModel
|
||||
{
|
||||
Id = id,
|
||||
Brand = brand,
|
||||
CosmeticName = cosmeticName,
|
||||
CosmeticPrice = double.Parse(cosmeticPrice.Replace(".", ","))
|
||||
});
|
||||
Response.Redirect("/Home/Wishes");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Delete(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
APIClient.PostRequest($"api/cosmetic/delete",
|
||||
new ServiceBindingModel() { Id = id });
|
||||
return;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<ProcedureViewModel>? GetAllProcedures()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
var procedures = APIClient.GetRequest<List<ProcedureViewModel>>($"api/procedure/getall");
|
||||
return procedures;
|
||||
}
|
||||
[HttpGet]
|
||||
public List<CosmeticViewModel>? GetAllByUser()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var cosmetics = APIClient.GetRequest<List<CosmeticViewModel>>
|
||||
($"api/cosmetic/getallbyuser?userId={APIClient.Client.Id}");
|
||||
return cosmetics;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using BeautySalonContracts.BindingModels;
|
||||
using BeautySalonContracts.ViewModels;
|
||||
using BeutySalonStaffMemberApp;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using StaffMemberWebApp.Models;
|
||||
using System.Diagnostics;
|
||||
|
||||
@ -13,12 +16,146 @@ namespace StaffMemberWebApp.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<StaffMemberViewModel>($"api/staffmember/login?login={login}&password={password}");
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
}
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
public IActionResult LaborCosts(int page)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if (page == 0)
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
ViewBag.LaborCosts = APIClient.GetRequest<List<LaborCostsViewModel>>
|
||||
($"api/laborcosts/getmany?userId={APIClient.Client.Id}&page={page}");
|
||||
ViewBag.Page = page;
|
||||
ViewBag.NumberOfPages = APIClient.GetRequest<int>
|
||||
($"api/laborcosts/getnumberofpages?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
public IActionResult Cosmetic(int page)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if (page == 0)
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
ViewBag.Cosmetic = APIClient.GetRequest<List<CosmeticViewModel>>
|
||||
($"api/cosmetic/getmany?userId={APIClient.Client.Id}&page={page}");
|
||||
ViewBag.Page = page;
|
||||
ViewBag.NumberOfPages = APIClient.GetRequest<int>
|
||||
($"api/cosmetic/getnumberofpages?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
public IActionResult Service(int page)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if (page == 0)
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
ViewBag.Service = APIClient.GetRequest<List<ServiceViewModel>>
|
||||
($"api/service/getmany?userId={APIClient.Client.Id}&page={page}");
|
||||
ViewBag.Page = page;
|
||||
ViewBag.NumberOfPages = APIClient.GetRequest<int>
|
||||
($"api/service/getnumberofpages?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult LaborCostsService()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult ListCosmetics()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.IsAllowed = true;
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public int[]? ListCosmetics([FromBody] CosmeticBindingModel listModel)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Array.Empty<int>();
|
||||
}
|
||||
byte[]? file = APIClient.PostRequestWithResult<CosmeticBindingModel, byte[]>
|
||||
("api/report/ListCosmetics", listModel);
|
||||
return file!.Select(b => (int)b).ToArray();
|
||||
}
|
||||
|
||||
public IActionResult ProcedureCosmetic()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Register(string login, string password, string email)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/staffmember/register", new StaffMemberBindingModel
|
||||
{
|
||||
StaffMemberEmail = email,
|
||||
StaffMemberLogin = login,
|
||||
StaffMemberPassword = password
|
||||
});
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
public IActionResult Report()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult ServiceCosmetic()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
@ -28,5 +165,28 @@ namespace StaffMemberWebApp.Controllers
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
[HttpPost]
|
||||
public List<ServiceViewModel>? Report([FromBody] StaffMemberBindingModel reportModel)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
reportModel.StaffMemberFIO = APIClient.Client.Id;
|
||||
List<ServiceViewModel>? list = APIClient.PostRequestWithResult
|
||||
<StaffMemberBindingModel, List<ServiceViewModel>>
|
||||
("api/report/GetServicesReportData", reportModel);
|
||||
return list;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Mails()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<MessageInfoViewModel>>($"api/client/getmessages?clientId={APIClient.Client.Id}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
using BeautySalonContracts.BindingModels;
|
||||
using BeautySalonContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BeutySalonStaffMemberApp.Controllers
|
||||
{
|
||||
public class LaborCostsController : Controller
|
||||
{
|
||||
public IActionResult Create()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Create(int numberHours, string difficulty)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIClient.PostRequest("api/laborcosts/create", new LaborCostsBindingModel
|
||||
{
|
||||
StaffMemberId = APIClient.Client.Id,
|
||||
NumberHours = numberHours,
|
||||
Difficulty = difficulty
|
||||
}); ;
|
||||
Response.Redirect("/Home/LaborCosts");
|
||||
}
|
||||
|
||||
public IActionResult Update(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.LaborCosts = APIClient.GetRequest<LaborCostsBindingModel>($"api/laborcosts/get?id={id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Update(int id, int numberHours, string difficulty)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIClient.PostRequest("api/laborcosts/update", new LaborCostsBindingModel
|
||||
{
|
||||
Id = id,
|
||||
NumberHours = numberHours,
|
||||
Difficulty = difficulty
|
||||
});
|
||||
Response.Redirect("/Home/LaborCosts");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Delete(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
APIClient.PostRequest($"api/laborcosts/delete",
|
||||
new ServiceBindingModel() { Id = id });
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
using BeautySalonContracts.BindingModels;
|
||||
using BeautySalonContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BeutySalonStaffMemberApp.Controllers
|
||||
{
|
||||
public class ServiceController : Controller
|
||||
{
|
||||
public IActionResult Create()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.LaborCostsList = APIClient.GetRequest<List<LaborCostsViewModel>>($"api/laborcosts/getall?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Create(string serviceName, string servicePrice, int laborCostsId)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIClient.PostRequest("api/service/create", new ServiceBindingModel
|
||||
{
|
||||
StaffMemberId = APIClient.Client.Id,
|
||||
ServiceName = serviceName,
|
||||
ServicePrice = double.Parse(servicePrice.Replace(".", ",")),
|
||||
});
|
||||
Response.Redirect("/Home/Service");
|
||||
}
|
||||
|
||||
public IActionResult Update(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Service = APIClient.GetRequest<ServiceBindingModel>
|
||||
($"api/service/get?id={id}");
|
||||
ViewBag.LaborCostsList = APIClient.GetRequest<List<LaborCostsViewModel>>
|
||||
($"api/laborcosts/getall?userId={APIClient.Client.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Update(int id, string serviceName, string servicePrice, int laborCostsId)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIClient.PostRequest("api/service/update", new ServiceBindingModel
|
||||
{
|
||||
Id = id,
|
||||
StaffMemberId = APIClient.Client.Id,
|
||||
ServiceName = serviceName,
|
||||
ServicePrice = double.Parse(servicePrice.Replace(".", ",")),
|
||||
});
|
||||
Response.Redirect("/Home/Service");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Delete(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
APIClient.PostRequest($"api/service/delete",
|
||||
new ServiceBindingModel() { Id = id });
|
||||
return;
|
||||
}
|
||||
|
||||
public IActionResult Bind(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.ServiceId = id;
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Bind([FromBody] ServiceBindingModel serviceModel)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIClient.PostRequest("api/service/update", serviceModel);
|
||||
}
|
||||
|
||||
public ServiceViewModel? Get(int id)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
ServiceViewModel? service = APIClient
|
||||
.GetRequest<ServiceViewModel>($"api/service/get?id={id}");
|
||||
return service;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user