2023-05-14 17:51:51 +04:00
|
|
|
|
using HotelContracts.BindingModels;
|
2023-05-16 17:41:58 +04:00
|
|
|
|
using HotelContracts.SearchModels;
|
2023-05-14 17:51:51 +04:00
|
|
|
|
using HotelContracts.ViewModels;
|
|
|
|
|
using HotelOrganiserApp.Models;
|
2023-04-07 13:49:59 +04:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System.Diagnostics;
|
2023-05-14 17:51:51 +04:00
|
|
|
|
using System.Text;
|
2023-04-07 13:49:59 +04:00
|
|
|
|
|
|
|
|
|
namespace HotelOrganiserApp.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
{
|
|
|
|
|
private readonly ILogger<HomeController> _logger;
|
|
|
|
|
|
|
|
|
|
public HomeController(ILogger<HomeController> logger)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-16 19:43:06 +04:00
|
|
|
|
/*--------------------MealPlans------------------------*/
|
|
|
|
|
|
|
|
|
|
public IActionResult CreateMealPlan()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void CreateMealPlan(string mealPlanName, double mealPlanPrice)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(mealPlanName) || string.IsNullOrEmpty(mealPlanPrice.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите название");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(mealPlanPrice.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите стоимость");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/main/createmealplan", new MealPlanBindingModel
|
|
|
|
|
{
|
|
|
|
|
MealPlanName = mealPlanName,
|
|
|
|
|
MealPlanPrice = mealPlanPrice,
|
|
|
|
|
OrganiserId = APIClient.Organiser.Id,
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("ListMealPlans");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult DeleteMealPlan()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.MealPlans = APIClient.GetRequest<List<MealPlanViewModel>>($"api/main/getmealplanlist?organiserId={APIClient.Organiser.Id}");
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void DeleteMealPlan(int mealPlan)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/main/deletemealplan", new MealPlanBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = mealPlan
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("ListMealPlans");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult UpdateMealPlan()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.MealPlans = APIClient.GetRequest<List<MealPlanViewModel>>($"api/main/getmealplanlist?organiserId={APIClient.Organiser.Id}");
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void UpdateMealPlan(int mealPlan, string mealPlanName, double mealPlanPrice)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(mealPlanName))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Название не может быть пустым");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(mealPlanPrice.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("стоимсоть не может быть пустым");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/main/updatemealplan", new MealPlanBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = mealPlan,
|
|
|
|
|
MealPlanName = mealPlanName,
|
|
|
|
|
MealPlanPrice = mealPlanPrice,
|
|
|
|
|
OrganiserId = APIClient.Organiser.Id
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("ListMealPlans");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public Tuple<MealPlanViewModel, string>? GetMealPlan(int mealPlanId)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
var result = APIClient.GetRequest<Tuple<MealPlanViewModel, List<Tuple<string, string>>>>($"api/main/getmealplan?mealPlanId={mealPlanId}");
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
return default;
|
|
|
|
|
}
|
|
|
|
|
string table = "";
|
|
|
|
|
for (int i = 0; i < result.Item2.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var memberFIO = result.Item2[i].Item1;
|
|
|
|
|
var citizenship = result.Item2[i].Item2;
|
|
|
|
|
table += "<tr style=\"height: 44px\">";
|
|
|
|
|
table += $"<td class=\"u-border-1 u-border-grey-30 u-table-cell\">{memberFIO}</td>";
|
|
|
|
|
table += $"<td class=\"u-border-1 u-border-grey-30 u-table-cell\">{citizenship}</td>";
|
|
|
|
|
table += "</tr>";
|
|
|
|
|
}
|
|
|
|
|
return Tuple.Create(result.Item1, table);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult AddMemberToMealPlan()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.MealPlans = APIClient.GetRequest<List<MealPlanViewModel>>($"api/main/getmealplanlist?organiserId={APIClient.Organiser.Id}");
|
|
|
|
|
ViewBag.Members = APIClient.GetRequest<List<MemberViewModel>>($"api/main/getmemberlist?organiserId={APIClient.Organiser.Id}");
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void AddMemberToMealPlan(int mealPlan, int member)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/main/AddMemberToMealPlan", Tuple.Create(
|
|
|
|
|
new MealPlanSearchModel() { Id = mealPlan },
|
|
|
|
|
new MemberViewModel() { Id = member }
|
|
|
|
|
));
|
|
|
|
|
Response.Redirect("ListMealPlans");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult ListMealPlans()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View(APIClient.GetRequest<List<MealPlanViewModel>>($"api/main/getmealplanlist?organiserId={APIClient.Organiser.Id}"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*--------------------Members------------------------*/
|
|
|
|
|
|
2023-05-14 21:46:57 +04:00
|
|
|
|
public IActionResult CreateMember()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void CreateMember(string fio, string citizenship)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(fio) || string.IsNullOrEmpty(citizenship))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите фио");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(citizenship))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите гражданство");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/main/createmember", new MemberBindingModel
|
|
|
|
|
{
|
|
|
|
|
MemberFIO = fio,
|
|
|
|
|
Citizenship = citizenship,
|
|
|
|
|
OrganiserId = APIClient.Organiser.Id,
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("ListMembers");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult UpdateMember()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.Members = APIClient.GetRequest<List<MemberViewModel>>($"api/main/getmemberlist?organiserId={APIClient.Organiser.Id}");
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void UpdateMember(int member, string fio, string citizenship)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(fio))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("фио не может быть пустым");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(citizenship))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Гражданство не может быть пустым");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
APIClient.PostRequest("api/main/updatemember", new MemberBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = member,
|
|
|
|
|
MemberFIO = fio,
|
|
|
|
|
Citizenship = citizenship,
|
|
|
|
|
OrganiserId = APIClient.Organiser.Id,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Response.Redirect("ListMembers");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult DeleteMember()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.Members = APIClient.GetRequest<List<MemberViewModel>>($"api/main/getmemberlist?organiserId={APIClient.Organiser.Id}");
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void DeleteMember(int member)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/main/deletemember", new MemberBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = member
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("ListMembers");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public MemberViewModel? GetMember(int memberId)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
var result = APIClient.GetRequest<MemberViewModel>($"api/main/getmember?memberid={memberId}");
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
return default;
|
|
|
|
|
}
|
|
|
|
|
var memberFIO = result.MemberFIO;
|
|
|
|
|
var citizenship = result.Citizenship;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-07 13:49:59 +04:00
|
|
|
|
public IActionResult Index()
|
|
|
|
|
{
|
2023-05-14 17:51:51 +04:00
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
2023-04-07 13:49:59 +04:00
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-14 21:46:57 +04:00
|
|
|
|
public IActionResult ListMembers()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View(APIClient.GetRequest<List<MemberViewModel>>($"api/main/getmemberlist?organiserId={APIClient.Organiser.Id}"));
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-16 19:43:06 +04:00
|
|
|
|
/*--------------------Conferences------------------------*/
|
|
|
|
|
|
2023-05-16 17:41:58 +04:00
|
|
|
|
public IActionResult CreateConference()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void CreateConference(string conferenceName, DateTime startDate)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(conferenceName) || string.IsNullOrEmpty(startDate.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите название");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(startDate.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите дату");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/main/createconference", new ConferenceBindingModel
|
|
|
|
|
{
|
|
|
|
|
ConferenceName = conferenceName,
|
|
|
|
|
StartDate = startDate,
|
|
|
|
|
OrganiserId = APIClient.Organiser.Id,
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("ListConferences");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult DeleteConference()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.Conferences = APIClient.GetRequest<List<ConferenceViewModel>>($"api/main/getconferencelist?organiserId={APIClient.Organiser.Id}");
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void DeleteConference(int conference)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/main/deleteconference", new ConferenceBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = conference
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("ListConferences");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult UpdateConference()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.Conferences = APIClient.GetRequest<List<ConferenceViewModel>>($"api/main/getconferencelist?organiserId={APIClient.Organiser.Id}");
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void UpdateConference(int conference, string conferenceName, DateTime startDate)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(conferenceName))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Название не может быть пустым");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(startDate.ToString()))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Дата не может быть пустым");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/main/updateconference", new ConferenceBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = conference,
|
|
|
|
|
ConferenceName = conferenceName,
|
|
|
|
|
StartDate = startDate,
|
|
|
|
|
OrganiserId = APIClient.Organiser.Id
|
|
|
|
|
});
|
|
|
|
|
Response.Redirect("ListConferences");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public Tuple<ConferenceViewModel, string>? GetConference(int conferenceId)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
var result = APIClient.GetRequest<Tuple<ConferenceViewModel, List<Tuple<string, string>>>>($"api/main/getconference?conferenceId={conferenceId}");
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
return default;
|
|
|
|
|
}
|
|
|
|
|
string table = "";
|
|
|
|
|
for (int i = 0; i < result.Item2.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var memberFIO = result.Item2[i].Item1;
|
|
|
|
|
var citizenship = result.Item2[i].Item2;
|
|
|
|
|
table += "<tr style=\"height: 44px\">";
|
|
|
|
|
table += $"<td class=\"u-border-1 u-border-grey-30 u-table-cell\">{memberFIO}</td>";
|
|
|
|
|
table += $"<td class=\"u-border-1 u-border-grey-30 u-table-cell\">{citizenship}</td>";
|
|
|
|
|
table += "</tr>";
|
|
|
|
|
}
|
|
|
|
|
return Tuple.Create(result.Item1, table);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult AddMemberToConference()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
ViewBag.Conferences = APIClient.GetRequest<List<ConferenceViewModel>>($"api/main/getconferencelist?organiserId={APIClient.Organiser.Id}");
|
|
|
|
|
ViewBag.Members = APIClient.GetRequest<List<MemberViewModel>>($"api/main/getmemberlist?organiserId={APIClient.Organiser.Id}");
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public void AddMemberToConference(int conference, int member)
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Необходима авторизация");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/main/AddMemberToConference", Tuple.Create(
|
|
|
|
|
new ConferenceSearchModel() { Id = conference },
|
|
|
|
|
new MemberViewModel() { Id = member }
|
|
|
|
|
));
|
|
|
|
|
Response.Redirect("ListConferences");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult ListConferences()
|
|
|
|
|
{
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View(APIClient.GetRequest<List<ConferenceViewModel>>($"api/main/getconferencelist?organiserId={APIClient.Organiser.Id}"));
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-16 19:43:06 +04:00
|
|
|
|
/*--------------------Organisers------------------------*/
|
|
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Privacy()
|
2023-04-07 13:49:59 +04:00
|
|
|
|
{
|
2023-05-14 17:51:51 +04:00
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
return Redirect("~/Home/Enter");
|
|
|
|
|
}
|
|
|
|
|
return View(APIClient.Organiser);
|
2023-04-07 13:49:59 +04:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Privacy(string login, string email, string password, string fio, string telephone)
|
2023-04-07 13:49:59 +04:00
|
|
|
|
{
|
2023-05-14 17:51:51 +04:00
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите логин, пароль и ФИО");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/organiser/updatedata", new OrganiserBindingModel
|
|
|
|
|
{
|
|
|
|
|
Id = APIClient.Organiser.Id,
|
|
|
|
|
OrganiserFIO = fio,
|
|
|
|
|
OrganiserLogin = login,
|
|
|
|
|
OrganiserPassword = password,
|
|
|
|
|
OrganiserEmail= email,
|
|
|
|
|
OrganiserNumber= telephone
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
APIClient.Organiser.OrganiserFIO = fio;
|
|
|
|
|
APIClient.Organiser.OrganiserLogin = login;
|
|
|
|
|
APIClient.Organiser.OrganiserPassword = password;
|
|
|
|
|
APIClient.Organiser.OrganiserEmail = email;
|
|
|
|
|
APIClient.Organiser.OrganiserNumber = telephone;
|
|
|
|
|
Response.Redirect("Index");
|
2023-04-07 13:49:59 +04:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
|
|
|
public IActionResult Error()
|
2023-04-07 13:49:59 +04:00
|
|
|
|
{
|
2023-05-14 17:51:51 +04:00
|
|
|
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
2023-04-07 13:49:59 +04:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Enter()
|
2023-04-07 13:49:59 +04:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Enter(string login, string password)
|
2023-04-07 13:49:59 +04:00
|
|
|
|
{
|
2023-05-14 17:51:51 +04:00
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите логин и пароль");
|
|
|
|
|
}
|
|
|
|
|
APIClient.Organiser = APIClient.GetRequest<OrganiserViewModel>($"api/organiser/login?login={login}&password={password}");
|
|
|
|
|
if (APIClient.Organiser == null)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Неверный логин/пароль");
|
|
|
|
|
}
|
|
|
|
|
Response.Redirect("Index");
|
2023-04-07 13:49:59 +04:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Register()
|
2023-04-07 13:49:59 +04:00
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
|
[HttpPost]
|
|
|
|
|
public void Register(string login, string email, string password, string fio, string telephone)
|
2023-04-07 13:49:59 +04:00
|
|
|
|
{
|
2023-05-14 17:51:51 +04:00
|
|
|
|
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Введите логин, пароль и ФИО");
|
|
|
|
|
}
|
|
|
|
|
APIClient.PostRequest("api/organiser/register", new OrganiserBindingModel
|
|
|
|
|
{
|
|
|
|
|
OrganiserFIO = fio,
|
|
|
|
|
OrganiserLogin = login,
|
|
|
|
|
OrganiserPassword = password,
|
|
|
|
|
OrganiserEmail = email,
|
|
|
|
|
OrganiserNumber = telephone
|
|
|
|
|
});
|
2023-04-07 13:49:59 +04:00
|
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
|
Response.Redirect("Enter");
|
|
|
|
|
return;
|
2023-04-07 13:49:59 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|