готовый CRUD и привязка
This commit is contained in:
parent
95a732593a
commit
b3a3c573f2
@ -8,6 +8,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HotelBusinessLogic.BusinessLogic
|
||||
@ -16,6 +17,7 @@ namespace HotelBusinessLogic.BusinessLogic
|
||||
{
|
||||
private readonly int _loginMaxLength = 25;
|
||||
private readonly int _passwordMaxLength = 50;
|
||||
private readonly int _passwordMinLength = 5;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrganiserStorage _organiserStorage;
|
||||
|
||||
@ -138,9 +140,9 @@ namespace HotelBusinessLogic.BusinessLogic
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля организатора", nameof(model.OrganiserPassword));
|
||||
}
|
||||
if (model.OrganiserPassword.Length > _passwordMaxLength)
|
||||
if (model.OrganiserPassword.Length > _passwordMaxLength || model.OrganiserPassword.Length < _passwordMinLength || !Regex.IsMatch(model.OrganiserPassword, @"^((\w+\d+\W+)|(\w+\W+\d+)|(\d+\w+\W+)|(\d+\W+\w+)|(\W+\w+\d+)|(\W+\d+\w+))[\w\d\W]*$"))
|
||||
{
|
||||
throw new ArgumentNullException("Пароль превышает допустимое количество символов", nameof(model.OrganiserPassword));
|
||||
throw new ArgumentNullException("Пароль превышает допустимое количество символов или их недостаточно", nameof(model.OrganiserPassword));
|
||||
}
|
||||
_logger.LogInformation("Organiser. OrganiserFIO: {OrganiserFIO}. OrganiserLogin: {OrganiserLogin}. OrganiserNumber: {OrganiserNumber}.OrganiserEmail: {OrganiserEmail}.OrganiserPassword: {OrganiserPassword}.Id: {Id}",
|
||||
model.OrganiserFIO, model.OrganiserLogin, model.OrganiserNumber, model.OrganiserEmail, model.OrganiserPassword, model.Id);
|
||||
|
@ -114,7 +114,14 @@ namespace HotelBusinessLogic.BusinessLogic
|
||||
throw new ArgumentNullException("Нет ФИО участника", nameof(model.ParticipantFIO));
|
||||
if (string.IsNullOrEmpty (model.Number))
|
||||
throw new ArgumentNullException("Нет номера участника", nameof(model.Number));
|
||||
|
||||
var elementName = _participantStorage.GetElement(new ParticipantSearchModel
|
||||
{
|
||||
ParticipantFIO = model.ParticipantFIO
|
||||
});
|
||||
if (elementName != null && elementName.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Участник с таким именем уже есть");
|
||||
}
|
||||
_logger.LogInformation("Participant. FIO:{FIO}.Number:{Number}. Id:{Id}", model.ParticipantFIO, model.Number, model.Id);
|
||||
}
|
||||
}
|
||||
|
@ -14,11 +14,14 @@ namespace HotelContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
public int AdministratorId { get; set; }
|
||||
public int? ConferenceId { get; set; }
|
||||
[DisplayName("Название комнаты")]
|
||||
public string PlaceСonference { get; set; } = string.Empty;
|
||||
[DisplayName("Дата конференции")]
|
||||
public DateTime? DateСonference { get; set; }
|
||||
public Dictionary<int, IDinnerModel> ConferenceBookingDinners { get; set; } = new();
|
||||
|
||||
public ConferenceBookingViewModel() { }
|
||||
|
||||
[JsonConstructor]
|
||||
public ConferenceBookingViewModel(Dictionary<int, DinnerViewModel> ConferenceBookingDinners)
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace HotelContracts.ViewModels
|
||||
{
|
||||
@ -24,6 +25,11 @@ namespace HotelContracts.ViewModels
|
||||
|
||||
|
||||
public Dictionary<int, IParticipantModel> ConferenceParticipants { get; set; } = new();
|
||||
//public Dictionary<int, IConferenceBookingModel> ConferenceConferenceBooking { get; set; } = new();
|
||||
public ConferenceViewModel() { }
|
||||
[JsonConstructor]
|
||||
public ConferenceViewModel(Dictionary<int, ParticipantViewModel> ConferenceParticipants)
|
||||
{
|
||||
this.ConferenceParticipants = ConferenceParticipants.ToDictionary(x => x.Key, x => x.Value as IParticipantModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HotelContracts.ViewModels
|
||||
@ -21,6 +22,16 @@ namespace HotelContracts.ViewModels
|
||||
public int OrganiserId { get; set; }
|
||||
|
||||
public Dictionary<int, IParticipantModel> MealPlanParticipants { get; set; } = new();
|
||||
//public Dictionary<int, IRoomModel> MealPlanRooms { get; set; } = new();
|
||||
public MealPlanViewModel()
|
||||
{
|
||||
MealPlanParticipants = new Dictionary<int, IParticipantModel>();
|
||||
}
|
||||
|
||||
[JsonConstructor]
|
||||
public MealPlanViewModel(Dictionary<int, ParticipantViewModel> MealPlanParticipants)
|
||||
{
|
||||
this.MealPlanParticipants = MealPlanParticipants?.ToDictionary(x => x.Key, x => x.Value as IParticipantModel)
|
||||
?? new Dictionary<int, IParticipantModel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,15 @@ namespace HotelDataBaseImplement.Implements
|
||||
.Include(x => x.Conferences)
|
||||
.FirstOrDefault(x => x.OrganiserEmail.Equals(model.OrganiserEmail))?
|
||||
.GetViewModel;
|
||||
|
||||
if (!string.IsNullOrEmpty(model.OrganiserLogin) && string.IsNullOrEmpty(model.OrganiserEmail) && !string.IsNullOrEmpty(model.OrganiserPassword))
|
||||
{
|
||||
return context.Organisers
|
||||
.Include(x => x.MealPlans)
|
||||
.Include(x => x.Participants)
|
||||
.Include(x => x.Conferences)
|
||||
.FirstOrDefault(x => x.OrganiserLogin.Equals(model.OrganiserLogin) && x.OrganiserPassword.Equals(model.OrganiserPassword))?
|
||||
.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,8 @@ namespace HotelDataBaseImplement.Models
|
||||
{
|
||||
if (_conferenceParticipents == null)
|
||||
{
|
||||
using var context = new HotelDataBase();
|
||||
_conferenceParticipents = Participants.ToDictionary(x => x.ParticipantId, x => (context.Participants
|
||||
.FirstOrDefault(y => y.Id == x.ParticipantId)! as IParticipantModel));
|
||||
_conferenceParticipents = Participants
|
||||
.ToDictionary(x => x.ParticipantId, x => (x.Participant as IParticipantModel));
|
||||
}
|
||||
return _conferenceParticipents;
|
||||
}
|
||||
@ -89,7 +88,11 @@ namespace HotelDataBaseImplement.Models
|
||||
public void UpdateMembers(HotelDataBase context, ConferenceBindingModel model)
|
||||
{
|
||||
var сonferenceParticipants = context.ConferenceParticipants.Where(rec => rec.ConferenceId == model.Id).ToList();
|
||||
|
||||
var list = new List<int>();
|
||||
foreach (var x in model.ConferenceParticipants)
|
||||
{
|
||||
list.Add(x.Key);
|
||||
}
|
||||
if (сonferenceParticipants != null && сonferenceParticipants.Count > 0)
|
||||
{
|
||||
context.ConferenceParticipants.RemoveRange(сonferenceParticipants.Where(rec => !model.ConferenceParticipants.ContainsKey(rec.ParticipantId)));
|
||||
|
@ -38,9 +38,8 @@ namespace HotelDataBaseImplement.Models
|
||||
{
|
||||
if( _mealPlanParticipants == null )
|
||||
{
|
||||
using var contex = new HotelDataBase();
|
||||
_mealPlanParticipants = Participants.ToDictionary(x => x.ParticipantId, x => (contex.Participants
|
||||
.FirstOrDefault(y => y.Id == x.ParticipantId)! as IParticipantModel));
|
||||
_mealPlanParticipants = Participants
|
||||
.ToDictionary(x => x.ParticipantId, x => (x.Participant as IParticipantModel));
|
||||
}
|
||||
return _mealPlanParticipants;
|
||||
}
|
||||
@ -80,7 +79,11 @@ namespace HotelDataBaseImplement.Models
|
||||
public void UpdateParticipants(HotelDataBase context, MealPlanBindingModel model)
|
||||
{
|
||||
var mealPlanParticipants = context.MealPlanParticipants.Where(rec => rec.MealPlanId == model.Id).ToList();
|
||||
|
||||
var list = new List<int>();
|
||||
foreach (var x in model.MealPlanParticipants)
|
||||
{
|
||||
list.Add(x.Key);
|
||||
}
|
||||
if (mealPlanParticipants != null && mealPlanParticipants.Count > 0)
|
||||
{
|
||||
context.MealPlanParticipants.RemoveRange(mealPlanParticipants.Where(rec => !model.MealPlanParticipants.ContainsKey(rec.ParticipantId)));
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HotelContracts.ViewModels;
|
||||
using HotelDataBaseImplement.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
@ -10,6 +11,7 @@ namespace HotelOrganiserApp
|
||||
private static readonly HttpClient _organiser = new();
|
||||
|
||||
public static OrganiserViewModel? Organiser { get; set; } = null;
|
||||
public static ParticipantViewModel? Participant { get; set; } = null;
|
||||
|
||||
public static void Connect(IConfiguration configuration)
|
||||
{
|
||||
|
@ -1,5 +1,13 @@
|
||||
using HotelOrganiserApp.Models;
|
||||
using HotelBusinessLogic.BusinessLogic;
|
||||
using HotelContracts.BindingModels;
|
||||
using HotelContracts.BusinessLogicsContracts;
|
||||
using HotelContracts.SearchModels;
|
||||
using HotelContracts.ViewModels;
|
||||
using HotelDataBaseImplement.Models;
|
||||
using HotelDataModels.Models;
|
||||
using HotelOrganiserApp.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace HotelOrganiserApp.Controllers
|
||||
@ -7,10 +15,12 @@ namespace HotelOrganiserApp.Controllers
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private readonly IParticipantLogic _participant;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
public HomeController(ILogger<HomeController> logger, IParticipantLogic participant)
|
||||
{
|
||||
_logger = logger;
|
||||
_participant = participant;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
@ -18,96 +28,488 @@ namespace HotelOrganiserApp.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.Organiser);
|
||||
}
|
||||
[HttpPost]
|
||||
public void Privacy(string login, string email, string password, string fio, string phone)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(phone))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/organiser/updatedata", new OrganiserBindingModel
|
||||
{
|
||||
Id = APIClient.Organiser.Id,
|
||||
OrganiserFIO = fio,
|
||||
OrganiserLogin = login,
|
||||
OrganiserPassword = password,
|
||||
OrganiserEmail = email,
|
||||
OrganiserNumber = phone
|
||||
});
|
||||
|
||||
APIClient.Organiser.OrganiserFIO = fio;
|
||||
APIClient.Organiser.OrganiserLogin = login;
|
||||
APIClient.Organiser.OrganiserPassword = password;
|
||||
APIClient.Organiser.OrganiserEmail = email;
|
||||
APIClient.Organiser.OrganiserNumber = phone;
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void Register(string fio, string login, string email, string password, string phone)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio) || string.IsNullOrEmpty(phone) || string.IsNullOrEmpty(email))
|
||||
{
|
||||
throw new Exception("Введите все данные");
|
||||
}
|
||||
APIClient.PostRequest("api/organiser/register", new OrganiserBindingModel
|
||||
{
|
||||
OrganiserFIO = fio,
|
||||
OrganiserLogin = login,
|
||||
OrganiserPassword = password,
|
||||
OrganiserEmail = email,
|
||||
OrganiserNumber = phone
|
||||
});
|
||||
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
{
|
||||
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");
|
||||
}
|
||||
/*-------------------------Participant---------------------------------*/
|
||||
public IActionResult Participants()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult MealPlans()
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return View();
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
public IActionResult Conferences()
|
||||
{
|
||||
return View();
|
||||
return View(APIClient.GetRequest<List<ParticipantViewModel>>($"api/main/getparticipantlist?organiserId={APIClient.Organiser.Id}"));
|
||||
}
|
||||
|
||||
public IActionResult CreateParticipant()
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateParticipant(string participantFIO, string number)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
if (string.IsNullOrEmpty(participantFIO) || string.IsNullOrEmpty(number))
|
||||
{
|
||||
throw new Exception("Введите данные");
|
||||
}
|
||||
APIClient.PostRequest("api/main/createparticipant", new ParticipantBindingModel
|
||||
{
|
||||
ParticipantFIO = participantFIO,
|
||||
Number = number,
|
||||
OrganiserId = APIClient.Organiser.Id,
|
||||
});
|
||||
Response.Redirect("Participants");
|
||||
}
|
||||
public IActionResult UpdateParticipant()
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Participants = APIClient.GetRequest<List<ParticipantViewModel>>($"api/main/getparticipantlist?organiserId={APIClient.Organiser.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateParticipant(int participant, string participantFIO, string number)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
if (string.IsNullOrEmpty(participantFIO) || string.IsNullOrEmpty(number))
|
||||
{
|
||||
throw new Exception("Данные пустые");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/main/updateparticipant", new ParticipantBindingModel
|
||||
{
|
||||
Id = participant,
|
||||
ParticipantFIO = participantFIO,
|
||||
Number = number,
|
||||
OrganiserId = APIClient.Organiser.Id,
|
||||
});
|
||||
|
||||
Response.Redirect("Participants");
|
||||
}
|
||||
public IActionResult DeleteParticipant()
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Participants = APIClient.GetRequest<List<ParticipantViewModel>>($"api/main/getparticipantlist?organiserId={APIClient.Organiser.Id}");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void DeleteParticipant(int participant)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
APIClient.PostRequest("api/main/deleteparticipant", new ParticipantBindingModel
|
||||
{
|
||||
Id = participant
|
||||
});
|
||||
Response.Redirect("Participants");
|
||||
}
|
||||
[HttpGet]
|
||||
public ParticipantViewModel? GetParticipant(int participantId)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
var result = APIClient.GetRequest<ParticipantViewModel>($"api/main/getparticipant?participantid={participantId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*-------------------------------MealPlans--------------------*/
|
||||
public IActionResult MealPlans()
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<MealPlanViewModel>>($"api/main/getmealplanlist?organiserId={APIClient.Organiser.Id}"));
|
||||
}
|
||||
public IActionResult CreateMealPlan()
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
var list = _participant.ReadList(new ParticipantSearchModel { OrganiserId = APIClient.Organiser.Id });
|
||||
var simpParticipant = list.Select(x => new { ParticipantId = x.Id, ParticipantFIO = x.ParticipantFIO });
|
||||
ViewBag.Participants = new MultiSelectList(simpParticipant, "ParticipantId", "ParticipantFIO");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateMealPlan(string mealPlanName, int mealPlanPrice, int[] participants)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
if (string.IsNullOrEmpty(mealPlanName) || mealPlanPrice <= 0 || participants.Length == 0)
|
||||
{
|
||||
throw new Exception("Введите данные");
|
||||
}
|
||||
Dictionary<int, IParticipantModel> MealPlanParticipants = new Dictionary<int, IParticipantModel>();
|
||||
foreach (int id in participants)
|
||||
{
|
||||
MealPlanParticipants.Add(id, _participant.ReadElement(new ParticipantSearchModel { Id = id }));
|
||||
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/main/createmealplan", new MealPlanBindingModel
|
||||
{
|
||||
MealPlanName = mealPlanName,
|
||||
MealPlanPrice = mealPlanPrice,
|
||||
OrganiserId = APIClient.Organiser.Id,
|
||||
});
|
||||
for (int i = 0; i < participants.Length; i++)
|
||||
{
|
||||
APIClient.PostRequest("api/main/AddParticipantToMealPlan", Tuple.Create(
|
||||
new MealPlanSearchModel() { MealPlanName = mealPlanName },
|
||||
new ParticipantViewModel() { Id = participants[i] }
|
||||
));
|
||||
}
|
||||
Response.Redirect("MealPlans");
|
||||
}
|
||||
public IActionResult UpdateMealPlan()
|
||||
{
|
||||
return View();
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
ViewBag.MealPlans = APIClient.GetRequest<List<MealPlanViewModel>>($"api/main/getmealplanlist?organiserId={APIClient.Organiser.Id}");
|
||||
ViewBag.Participants = APIClient.GetRequest<List<ParticipantViewModel>>($"api/main/getparticipantlist?organiserId={APIClient.Organiser.Id}");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdateMealPlan(int mealPlan, string mealPlanName, int mealPlanPrice, List<int> participants)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
if (string.IsNullOrEmpty(mealPlanName) || mealPlanPrice <= 0)
|
||||
{
|
||||
throw new Exception("Введите данные");
|
||||
}
|
||||
Dictionary<int, IParticipantModel> participant = new Dictionary<int, IParticipantModel>();
|
||||
foreach (int din in participants)
|
||||
{
|
||||
participant.Add(din, new ParticipantSearchModel { Id = din } as IParticipantModel);
|
||||
}
|
||||
APIClient.PostRequest("api/main/updatemealplan", new MealPlanBindingModel
|
||||
{
|
||||
Id = mealPlan,
|
||||
MealPlanName = mealPlanName,
|
||||
MealPlanPrice = mealPlanPrice,
|
||||
OrganiserId = APIClient.Organiser.Id,
|
||||
MealPlanParticipants = participant,
|
||||
});
|
||||
Response.Redirect("MealPlans");
|
||||
}
|
||||
public IActionResult DeleteMealPlan()
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Rooms = APIClient.GetRequest<List<RoomViewModel>>($"api/main/getmealplanlist?organiserId={APIClient.Organiser.Id}");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void DeleteMealPlan(int room)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
APIClient.PostRequest("api/main/deletemealplan", new MealPlanBindingModel
|
||||
{
|
||||
Id = room
|
||||
});
|
||||
Response.Redirect("MealPlans");
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<MealPlanViewModel, List<Tuple<string, double>>>? GetMealPlan(int mealPlanId)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
var result = APIClient.GetRequest<Tuple<MealPlanViewModel, List<Tuple<string, double>>>>($"api/main/getmealplan?mealplanid={mealPlanId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/*----------------------------Conferences--------------------*/
|
||||
public IActionResult Conferences()
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<ConferenceViewModel>>($"api/main/getconferencelist?organiserId={APIClient.Organiser.Id}"));
|
||||
}
|
||||
|
||||
public IActionResult CreateConference()
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
var list = _participant.ReadList(new ParticipantSearchModel { OrganiserId = APIClient.Organiser.Id });
|
||||
var simpParticipant = list.Select(x => new { ParticipantId = x.Id, ParticipantFIO = x.ParticipantFIO });
|
||||
ViewBag.Participants = new MultiSelectList(simpParticipant, "ParticipantId", "ParticipantFIO");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateConference(string conferenceName, string subject, int[] participants, DateTime startDate)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
if (string.IsNullOrEmpty(conferenceName))
|
||||
{
|
||||
throw new Exception("Введите данные");
|
||||
}
|
||||
Dictionary<int, IParticipantModel> ConferenceParticipants = new Dictionary<int, IParticipantModel>();
|
||||
foreach (int id in participants)
|
||||
{
|
||||
ConferenceParticipants.Add(id, _participant.ReadElement(new ParticipantSearchModel { Id = id }));
|
||||
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/main/createconference", new ConferenceBindingModel
|
||||
{
|
||||
ConferenceName = conferenceName,
|
||||
Subject = subject,
|
||||
StartDate = startDate,
|
||||
OrganiserId = APIClient.Organiser.Id,
|
||||
});
|
||||
for (int i = 0; i < participants.Length; i++)
|
||||
{
|
||||
APIClient.PostRequest("api/main/AddParticipantToConference", Tuple.Create(
|
||||
new ConferenceSearchModel() { ConferenceName = conferenceName },
|
||||
new ParticipantViewModel() { Id = participants[i] }
|
||||
));
|
||||
}
|
||||
Response.Redirect("Conferences");
|
||||
}
|
||||
|
||||
public IActionResult UpdateConference()
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Conferences = APIClient.GetRequest<List<ConferenceViewModel>>($"api/main/getconferencelist?organiserid={APIClient.Organiser.Id}");
|
||||
ViewBag.Participants = APIClient.GetRequest<List<ParticipantViewModel>>($"api/main/getparticipantlist?organiserid={APIClient.Organiser.Id}");
|
||||
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdateConference(int conference, string conferenceName, string subject, DateTime startDate, List<int> participants)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
if (string.IsNullOrEmpty(conferenceName))
|
||||
{
|
||||
throw new Exception("Введите данные");
|
||||
}
|
||||
Dictionary<int, IParticipantModel> participant = new Dictionary<int, IParticipantModel>();
|
||||
foreach (int din in participants)
|
||||
{
|
||||
participant.Add(din, new ParticipantSearchModel { Id = din } as IParticipantModel);
|
||||
}
|
||||
APIClient.PostRequest("api/main/updateConference", new ConferenceBindingModel
|
||||
{
|
||||
Id = conference,
|
||||
ConferenceName = conferenceName,
|
||||
Subject = subject,
|
||||
StartDate = startDate,
|
||||
OrganiserId = APIClient.Organiser.Id,
|
||||
ConferenceParticipants = participant,
|
||||
});
|
||||
Response.Redirect("Conferences");
|
||||
}
|
||||
|
||||
public IActionResult DeleteConference()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult AddParticipantToConferences()
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Conferences = APIClient.GetRequest<List<ConferenceViewModel>>($"api/main/getconferencelist?organiserid={APIClient.Organiser.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult AddParticipantToMealPlan()
|
||||
[HttpPost]
|
||||
public void DeleteConference(int conference)
|
||||
{
|
||||
return View();
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
APIClient.PostRequest("api/main/deleteconference", new ConferenceBindingModel
|
||||
{
|
||||
Id = conference
|
||||
});
|
||||
Response.Redirect("Conferences");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ConferenceViewModel? GetConference(int conferenceId)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
var result = APIClient.GetRequest<ConferenceViewModel>($"api/main/getconference?conferenceid={conferenceId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*--------------------------AddConferenceBookingToConference------------------------------*/
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult AddConferenceBookingToConference()
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Conferences = APIClient.GetRequest<List<ConferenceViewModel>>($"api/main/getconferencelist?organiserid={APIClient.Organiser.Id}");
|
||||
ViewBag.ConferenceBookings = APIClient.GetRequest<List<ConferenceBookingViewModel>>($"api/main/getConferenceBookings");
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void AddConferenceBookingToConference(int conference, int conferencebooking, DateTime dateСonference)
|
||||
{
|
||||
if (APIClient.Organiser == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
var conferenceBookingElem = APIClient.GetRequest<ConferenceBookingViewModel>($"api/main/getConferenceBookingById?conferenceBookingId={conferencebooking}");
|
||||
APIClient.PostRequest("api/main/updateconferenceBooking", new ConferenceBookingBindingModel
|
||||
{
|
||||
Id = conferencebooking,
|
||||
ConferenceId = conference,
|
||||
PlaceСonference = conferenceBookingElem.PlaceСonference,
|
||||
DateСonference = conferenceBookingElem.DateСonference,
|
||||
AdministratorId = conferenceBookingElem.AdministratorId,
|
||||
});
|
||||
Response.Redirect("Conferences");
|
||||
}
|
||||
|
||||
public IActionResult ListParticipantToPdfFile()
|
||||
{
|
||||
return View();
|
||||
|
@ -1,6 +1,15 @@
|
||||
using HotelBusinessLogic.BusinessLogic;
|
||||
using HotelContracts.BusinessLogicsContracts;
|
||||
using HotelContracts.StoragesContracts;
|
||||
using HotelDataBaseImplement.Implements;
|
||||
using HotelOrganiserApp;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddTransient<IParticipantStorage, ParticipantStorage>();
|
||||
builder.Services.AddTransient<IParticipantLogic, ParticipantLogic>();
|
||||
builder.Services.AddTransient<IMealPlanStorage, MealPlanStorage>();
|
||||
builder.Services.AddTransient<IConferenceStorage, ConferenceStorage>();
|
||||
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
@ -1,4 +1,7 @@
|
||||
@{
|
||||
@using HotelContracts.ViewModels;
|
||||
@using HotelDataModels.Models;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "AddConferenceBookingToConference";
|
||||
}
|
||||
<head>
|
||||
@ -25,11 +28,11 @@
|
||||
<form method="post">
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Наименование конференции: </label>
|
||||
<select class="form-control"></select>
|
||||
<select id="conference" name="conference" class="form-control" asp-items="@(new SelectList(@ViewBag.Conferences, "Id", "ConferenceName"))"></select>
|
||||
</div>
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Место конференции: </label>
|
||||
<select class="form-control"></select>
|
||||
<select id="conferencebooking" name="conferencebooking" class="form-control" asp-items="@(new SelectList(@ViewBag.ConferenceBookings, "Id", "PlaceСonference"))"></select>
|
||||
</div>
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Начало: </label>
|
||||
|
@ -1,66 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "AddParticipantToConferences";
|
||||
}
|
||||
<head>
|
||||
<style>
|
||||
.general_style {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.button_action {
|
||||
display: flex;
|
||||
background-color: #5a9ad6;
|
||||
}
|
||||
|
||||
.button_action:hover {
|
||||
background-color: #225df2;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.ord{
|
||||
display: flex;
|
||||
justify-content: center !important;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.list-words-add{
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<div class="text-center">
|
||||
<h2 class="ord"> Добавить участника в конференцию</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label for="room">Выберите конференцию</label>
|
||||
<select id="room" name="room" class="form-control">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="list-words-add">Выберите участника</label>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ФИО участника</th>
|
||||
<th>Номер телефона</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
<button class="btn button_action">Сохранить</button>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="Conferences" class="btn button_action">Назад</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -1,67 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "AddParticipantToMealPlan";
|
||||
}
|
||||
<head>
|
||||
<style>
|
||||
.general_style {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.button_action {
|
||||
display: flex;
|
||||
background-color: #5a9ad6;
|
||||
}
|
||||
|
||||
.button_action:hover {
|
||||
background-color: #225df2;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.ord {
|
||||
display: flex;
|
||||
justify-content: center !important;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.list-words-add {
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<div class="text-center">
|
||||
<h2 class="ord"> Добавить участника в план питания</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label for="room">Выберите план питания</label>
|
||||
<select id="room" name="room" class="form-control">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="list-words-add">Выберите участника</label>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ФИО участника</th>
|
||||
<th>Номер телефона</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
<button class="btn button_action">Сохранить</button>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="MealPlans" class="btn button_action">Назад</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -1,4 +1,8 @@
|
||||
@{
|
||||
@using HotelContracts.ViewModels
|
||||
|
||||
@model List<ConferenceViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Conferences";
|
||||
}
|
||||
|
||||
@ -40,6 +44,23 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr style="height: 75px">
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ConferenceName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Subject)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.StartDate)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="general_style">
|
||||
@ -55,14 +76,6 @@
|
||||
<a asp-area="" asp-controller="Home" asp-action="DeleteConference"
|
||||
class="btn button_action">Удалить</a>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="AddParticipantToConferences"
|
||||
class="btn button_action">Добавить участника</a>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="AddConferenceBookingToConference"
|
||||
class="btn button_action">Привязка к брони по конференции</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -1,4 +1,8 @@
|
||||
@{
|
||||
@using HotelContracts.ViewModels
|
||||
|
||||
@model ParticipantViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "CreateConference";
|
||||
}
|
||||
<style>
|
||||
@ -30,11 +34,24 @@
|
||||
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Добавить конференцию</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<input type="text" placeholder="Введите название конференции" class="form-control" />
|
||||
<input type="text" placeholder="Введите тематику конференции" class="form-control" />
|
||||
<input type="text" name="conferenceName" placeholder="Введите название конференции" class="form-control" />
|
||||
<input type="text" name="subject" placeholder="Введите тематику конференции" class="form-control" />
|
||||
<div class="form-control">
|
||||
<label class="form-control">Начало</label>
|
||||
<input type="datetime-local"
|
||||
placeholder="Выберите дату начала"
|
||||
name="startDate"
|
||||
class="form-control" />
|
||||
</div>
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Участники: </label>
|
||||
<div>
|
||||
@Html.ListBox("participants", (MultiSelectList)ViewBag.Participants, new { @class = "form-control", size = "10" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
<button class="btn button_action">Сохранить</button>
|
||||
<button type="submit" class="btn button_action">Сохранить</button>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="Conferences" class="btn button_action">Назад</a>
|
||||
|
@ -1,4 +1,8 @@
|
||||
@{
|
||||
@using HotelContracts.ViewModels
|
||||
|
||||
@model ParticipantViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "CreateMealPlan";
|
||||
}
|
||||
<style>
|
||||
@ -30,11 +34,17 @@
|
||||
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Добавить план питания</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<input type="text" placeholder="Введите название плана питания" class="form-control" />
|
||||
<input type="text" placeholder="Введите стоимость плана питания" class="form-control" />
|
||||
<input type="text" name="mealPlanName" placeholder="Введите название плана питания" class="form-control" />
|
||||
<input type="text" name="mealPlanPrice" placeholder="Введите стоимость плана питания" class="form-control" step="1000" />
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Участники: </label>
|
||||
<div>
|
||||
@Html.ListBox("participants", (MultiSelectList)ViewBag.Participants, new { @class = "form-control", size = "10" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
<button class="btn button_action">Сохранить</button>
|
||||
<button class="btn button_action" type="submit">Сохранить</button>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="MealPlans" class="btn button_action">Назад</a>
|
||||
|
@ -29,11 +29,11 @@
|
||||
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Добавить участника</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<input type="text" placeholder="Введите ФИО участника" class="form-control" />
|
||||
<input type="text" placeholder="Введите номер телефона участника" class="form-control" />
|
||||
<input type="text" placeholder="Введите ФИО участника" name="participantFIO" class="form-control" />
|
||||
<input type="text" placeholder="Введите номер телефона участника" name="number" class="form-control" />
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
<button class="btn button_action">Сохранить</button>
|
||||
<button type="submit" class="btn button_action">Сохранить</button>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="Participants" class="btn button_action">Назад</a>
|
||||
|
@ -36,11 +36,11 @@
|
||||
<form method="post">
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Конференции: </label>
|
||||
<select class="form-control"></select>
|
||||
<select id="conference" name="conference" class="form-control" asp-items="@(new SelectList(@ViewBag.Conferences, "Id", "ConferenceName"))"></select>
|
||||
</div>
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
<button class="btn button_action">Сохранить</button>
|
||||
<button type="submit" class="btn button_action">Удалить</button>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="Conferences" class="btn button_action">Назад</a>
|
||||
|
@ -36,11 +36,11 @@
|
||||
<form method="post">
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Планы питания: </label>
|
||||
<select class="form-control"></select>
|
||||
<select id="mealPlan" name="mealPlan" class="form-control" asp-items="@(new SelectList(@ViewBag.MealPlans, "Id", "MealPlanName"))"></select>
|
||||
</div>
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
<button class="btn button_action">Сохранить</button>
|
||||
<button type="submit" class="btn button_action">Сохранить</button>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="MealPlans" class="btn button_action">Назад</a>
|
||||
|
@ -36,11 +36,11 @@
|
||||
<form method="post">
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Участники: </label>
|
||||
<select class="form-control"></select>
|
||||
<select id="participant" name="participant" class="form-control" asp-items="@(new SelectList(@ViewBag.Participants, "Id", "ParticipantFIO"))"></select>
|
||||
</div>
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
<button class="btn button_action">Сохранить</button>
|
||||
<button class="btn button_action" type="submit">Удалить</button>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="Participants" class="btn button_action">Назад</a>
|
||||
|
@ -40,10 +40,10 @@
|
||||
<h2 class="text-center mb-5">Регистрация</h2>
|
||||
<form>
|
||||
<div data-mdb-input-init class="form-outline mb-4">
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Логин/Почта" />
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Логин/Почта" name="login" />
|
||||
</div>
|
||||
<div data-mdb-input-init class="form-outline mb-4">
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Пароль" />
|
||||
<input type="password" id="form3Example1cg" class="form-control form-control-lg" placeholder="Пароль" name="password"/>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button type="submit"
|
||||
|
@ -1,4 +1,8 @@
|
||||
@{
|
||||
@using HotelContracts.ViewModels
|
||||
|
||||
@model List<MealPlanViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "MealPlans";
|
||||
}
|
||||
|
||||
@ -40,6 +44,20 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr style="height: 75px">
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.MealPlanName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.MealPlanPrice)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="general_style">
|
||||
@ -55,10 +73,6 @@
|
||||
<a asp-area="" asp-controller="Home" asp-action="DeleteMealPlan"
|
||||
class="btn button_action">Удалить</a>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="AddParticipantToMealPlan"
|
||||
class="btn button_action">Добавить участника</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -1,4 +1,8 @@
|
||||
@{
|
||||
@using HotelContracts.ViewModels
|
||||
|
||||
@model List<ParticipantViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Participants";
|
||||
}
|
||||
|
||||
@ -40,6 +44,20 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr style="height: 75px">
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ParticipantFIO)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Number)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="general_style">
|
||||
|
@ -1,6 +1,6 @@
|
||||
@using HotelContracts.ViewModels
|
||||
|
||||
@model AdministratorViewModel
|
||||
@model OrganiserViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Privacy";
|
||||
@ -30,31 +30,31 @@
|
||||
<div class="form-group row mt-3">
|
||||
<label class="col-sm-3 col-form-label labels">Логин</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" name="login">
|
||||
<input type="text" class="form-control" name="login" value="@Model.OrganiserLogin">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row mt-3">
|
||||
<label class="col-sm-3 col-form-label labels">Почта</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control">
|
||||
<input type="email" name="email" class="form-control" value="@Model.OrganiserEmail">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row mt-3">
|
||||
<label class="col-sm-3 col-form-label labels">Пароль</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="password" class="form-control">
|
||||
<input type="password" class="form-control" name="password" value="@Model.OrganiserPassword">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row mt-3">
|
||||
<label class="col-sm-3 col-form-label labels">ФИО</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control">
|
||||
<input type="text" name="fio" class="form-control" value="@Model.OrganiserFIO" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row mt-3">
|
||||
<label class="col-sm-3 col-form-label labels">Номер</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control">
|
||||
<input type="text" name="phone" class="form-control" value="@Model.OrganiserNumber" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -36,19 +36,19 @@
|
||||
<h2 class="text-center mb-5">Регистрация</h2>
|
||||
<form>
|
||||
<div data-mdb-input-init class="form-outline mb-4">
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="ФИО" />
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="ФИО" name="fio" />
|
||||
</div>
|
||||
<div data-mdb-input-init class="form-outline mb-4">
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Логин" />
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Логин" name="login" />
|
||||
</div>
|
||||
<div data-mdb-input-init class="form-outline mb-4">
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Эл. почта" />
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Эл. почта" name="email" />
|
||||
</div>
|
||||
<div data-mdb-input-init class="form-outline mb-4">
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Номер телефона" />
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Номер телефона" name="phone" />
|
||||
</div>
|
||||
<div data-mdb-input-init class="form-outline mb-4">
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Пароль" />
|
||||
<input type="text" id="form3Example1cg" class="form-control form-control-lg" placeholder="Пароль" name="password" />
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<button type="submit"
|
||||
|
@ -36,13 +36,20 @@
|
||||
<form method="post">
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Конференции: </label>
|
||||
<select class="form-control"></select>
|
||||
<select id="conference" name="conference" class="form-control" asp-items="@(new SelectList(@ViewBag.Conferences, "Id", "ConferenceName"))"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="Введите название конференции" class="form-control" />
|
||||
<input type="text" name="conferenceName" placeholder="Введите название конференции" class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="Введите тематику конференции" class="form-control" />
|
||||
<input type="text" name="subject" placeholder="Введите тематику конференции" class="form-control" />
|
||||
</div>
|
||||
<div class="form-control">
|
||||
<label class="form-control">Начало</label>
|
||||
<input type="datetime-local"
|
||||
placeholder="Выберите дату начала"
|
||||
name="startDate"
|
||||
class="form-control" />
|
||||
</div>
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
@ -53,3 +60,28 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var conference = $('#conference').val();
|
||||
if (conference {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetConference",
|
||||
data: { conferenceId: conference },
|
||||
success: function (result) {
|
||||
$('#conferenceName').val(result.ConferenceName);
|
||||
$('#subject').val(result.Subject);
|
||||
$('#startDate').val(result.StartDate);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#conference').on('change', function () {
|
||||
check();
|
||||
});
|
||||
</script>
|
||||
}
|
@ -36,13 +36,13 @@
|
||||
<form method="post">
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Планы питания: </label>
|
||||
<select class="form-control"></select>
|
||||
<select id="mealPlan" name="mealPlan" class="form-control" asp-items="@(new SelectList(@ViewBag.MealPlans, "Id", "MealPlanName"))"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="Введите название плана питания" class="form-control" />
|
||||
<input name="mealPlanName" type="text" placeholder="Введите название плана питания" class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="Введите стоимость плана питания" class="form-control" />
|
||||
<input name="mealPlanPrice" type="text" placeholder="Введите стоимость плана питания" class="form-control" step="1000" />
|
||||
</div>
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
@ -53,3 +53,27 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var mealPlan = $('#mealPlan').val();
|
||||
if (mealPlan) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetMealPlan",
|
||||
data: { mealPlanId: mealPlan },
|
||||
success: function (result) {
|
||||
$('#mealPlanName').val(result.MealPlanName);
|
||||
$('#mealPlanPrice').val(result.MealPlanPrice);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#mealPlan').on('change', function () {
|
||||
check();
|
||||
});
|
||||
</script>
|
||||
}
|
@ -36,20 +36,44 @@
|
||||
<form method="post">
|
||||
<div class="spisok">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Участники: </label>
|
||||
<select class="form-control"></select>
|
||||
<select id="participant" name="participant" class="form-control" asp-items="@(new SelectList(@ViewBag.Participants, "Id", "ParticipantFIO"))"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="Введите ФИО участника" class="form-control" />
|
||||
<input type="text" name="participantFIO" placeholder="Введите ФИО участника" class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="Введите номер телефона участника" class="form-control" />
|
||||
<input type="text" name="number" placeholder="Введите номер телефона участника" class="form-control" />
|
||||
</div>
|
||||
<div class="general_style">
|
||||
<div class="button">
|
||||
<button class="btn button_action">Сохранить</button>
|
||||
<button class="btn button_action" type="submit">Сохранить</button>
|
||||
</div>
|
||||
<div class="button">
|
||||
<a asp-area="" asp-controller="Home" asp-action="Participants" class="btn button_action">Назад</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var member = $('#participant').val();
|
||||
if (member) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetParticipant",
|
||||
data: { memberId: member },
|
||||
success: function (result) {
|
||||
$('#participantFIO').val(result.participantFIO);
|
||||
$('#number').val(result.number);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#participant').on('change', function () {
|
||||
check();
|
||||
});
|
||||
</script>
|
||||
}
|
@ -104,6 +104,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item punkt">
|
||||
<a class="nav-link" asparea="" asp-controller="Home" asp-action="AddConferenceBookingToConference">Привязка к брони по конференции</a>
|
||||
</li>
|
||||
<li class="nav-item punkt">
|
||||
<a class="nav-link" asparea="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||
</li>
|
||||
|
@ -570,5 +570,34 @@ namespace HotelRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<ConferenceBookingViewModel>? GetConferenceBookings()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _conferenceBooking.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка конференций");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public ConferenceBookingViewModel GetConferenceBookingById(int conferenceBookingId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var elem = _conferenceBooking.ReadElement(new ConferenceBookingSearchModel { Id = conferenceBookingId });
|
||||
if (elem == null)
|
||||
return null;
|
||||
return elem;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения по id={Id}", conferenceBookingId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user