diff --git a/GetSit/Controllers/SpaceManagementController.cs b/GetSit/Controllers/SpaceManagementController.cs index 2216189..f4249f8 100644 --- a/GetSit/Controllers/SpaceManagementController.cs +++ b/GetSit/Controllers/SpaceManagementController.cs @@ -13,7 +13,7 @@ namespace GetSit.Controllers { - [Authorize(Roles = "Provider")]//Error:Convert UserRole to class + [Authorize(Roles = "Provider")]//Error:Convert UserRole to class public class SpaceManagementController : Controller { #region Dependacies @@ -27,6 +27,7 @@ public class SpaceManagementController : Controller readonly ISpaceService_Service _spaceService_service; readonly IServicePhotoService _servicePhotoService; readonly IBookingService _bookingService; + readonly IHallRequestService _hallRequestService; public SpaceManagementController(IUserManager userManager, AppDBcontext context, ISpaceEmployeeService spaceEmployeeService, @@ -36,7 +37,9 @@ public SpaceManagementController(IUserManager userManager, IHallPhotoService hallPhotoService, ISpaceService_Service spaceService_service, IServicePhotoService servicePhotoService, - IBookingService bookingService) + IBookingService bookingService, + IHallRequestService HallRequestService) + { _userManager = userManager; _context = context; @@ -48,6 +51,7 @@ public SpaceManagementController(IUserManager userManager, _spaceService_service = spaceService_service; _servicePhotoService = servicePhotoService; _bookingService = bookingService; + _hallRequestService = HallRequestService; } #endregion public async Task IndexAsync() @@ -58,8 +62,10 @@ public async Task IndexAsync() { var providerId = _userManager.GetCurrentUserId(HttpContext); var provider = await _providerService.GetByIdAsync(providerId); - spaceIdInt = (int)provider.SpaceId; - SpaceIdStirng = spaceIdInt.ToString(); + + spaceIdInt = (int) provider.SpaceId; + SpaceIdStirng = provider.ToString(); + if(SpaceIdStirng != String.Empty) HttpContext.Response.Cookies.Append("SpaceId", SpaceIdStirng); } @@ -72,10 +78,11 @@ public async Task IndexAsync() SpaceManagementVM viewModel = new() { Space = space, - Halls = _hallService.GetBySpaceId(spaceIdInt,h=>h.HallPhotos,h=>h.HallFacilities), + Halls = _hallService.GetAcceptedBySpaceId(spaceIdInt,h=>h.HallPhotos,h=>h.HallFacilities), Services = _spaceService_service.GetBySpaceId(spaceIdInt, s => s.ServicePhotos), Employees = _providerService.GetBySpaceId(spaceIdInt), - Bookings = _bookingService.GetBySpaceId(spaceIdInt) + Bookings = _bookingService.GetBySpaceId(spaceIdInt), + Requests= _hallRequestService.GetPendingBySpaceId(spaceIdInt), }; return View(viewModel); } @@ -84,13 +91,13 @@ public async Task IndexAsync() public async Task AddHallAsync() { var SpaceIdStirng = ""; - var spaceIdInt=0; + var spaceIdInt = 0; if (HttpContext.Request.Cookies.Where(c => c.Key == "SpaceId").FirstOrDefault().Value is null) { var providerId = _userManager.GetCurrentUserId(HttpContext); - //var provider = _context.SpaceEmployee.Where(e => e.Id == providerId).FirstOrDefault(); var provider = await _providerService.GetByIdAsync(providerId); - SpaceIdStirng = provider.SpaceId.ToString(); + spaceIdInt = (int)provider.SpaceId; + SpaceIdStirng = provider.ToString(); if (SpaceIdStirng != String.Empty) HttpContext.Response.Cookies.Append("SpaceId", SpaceIdStirng); } @@ -100,8 +107,9 @@ public async Task AddHallAsync() int.TryParse(SpaceIdStirng, out spaceIdInt); } //Space space = _context.Space.Include(s => s.Photos).Where(s => s.Id.ToString() == SpaceId).FirstOrDefault(); + spaceIdInt = 2; Space space =await _spaceSerivce.GetByIdAsync(spaceIdInt, s=>s.Photos); - AddHallVM vm = new() + AddHallVM vm = new AddHallVM() { SpaceId = space.Id, SpaceName = space.Name, @@ -165,10 +173,18 @@ await _hallPhotoService.AddAsync(new HallPhoto() }); } } + /*Add request*/ + var request = new HallRequest() + { + Hall=hall, + Status = ReqestStatus.pending, + Date = DateTime.Now, + }; + _hallRequestService.AddRequest(request); + return RedirectToAction("Index"); } #endregion - #region Create New Service [HttpGet] public async Task AddServiceAsync() diff --git a/GetSit/Controllers/SystemAdminController.cs b/GetSit/Controllers/SystemAdminController.cs new file mode 100644 index 0000000..cc2deaa --- /dev/null +++ b/GetSit/Controllers/SystemAdminController.cs @@ -0,0 +1,80 @@ +using GetSit.Data.Security; +using GetSit.Data.Services; +using GetSit.Data; + +using Microsoft.AspNetCore.Mvc; +using GetSit.Data.enums; + +namespace GetSit.Controllers +{ + public class SystemAdminController : Controller + { + #region Dependacies + readonly IUserManager _userManager; + readonly AppDBcontext _context; + readonly ISpaceEmployeeService _providerService; + readonly ISpaceService _spaceSerivce; + readonly ISpaceHallService _hallService; + readonly IHallFacilityService _hallFacilityService; + readonly IHallPhotoService _hallPhotoService; + readonly ISpaceService_Service _spaceService_service; + readonly IServicePhotoService _servicePhotoService; + readonly IBookingService _bookingService; + readonly IHallRequestService _hallRequestService; + public SystemAdminController(IUserManager userManager, + AppDBcontext context, + ISpaceEmployeeService spaceEmployeeService, + ISpaceService spaceService, + ISpaceHallService hallService, + IHallFacilityService hallFacilityService, + IHallPhotoService hallPhotoService, + ISpaceService_Service spaceService_service, + IServicePhotoService servicePhotoService, + IBookingService bookingService, + IHallRequestService HallRequestService) + + { + _userManager = userManager; + _context = context; + _providerService = spaceEmployeeService; + _spaceSerivce = spaceService; + _hallService = hallService; + _hallFacilityService = hallFacilityService; + _hallPhotoService = hallPhotoService; + _spaceService_service = spaceService_service; + _servicePhotoService = servicePhotoService; + _bookingService = bookingService; + _hallRequestService = HallRequestService; + } + #endregion + public IActionResult Index() + { + return View(); + } + public IActionResult ViewRepest(int requestId) + { + return View(); + } + [HttpGet] + public IActionResult AcceptRepest(int requestId) { + var request= _hallRequestService.GetById(requestId); + var hall =request.Hall; + hall.Status = HallStatus.Accepted; + _hallService.UpdateHall(hall); + _hallRequestService.DeleteRequest(request); + return View("Index"); + } + + [HttpPost] + public IActionResult RejectRepest(int requestId,string comment) + { + var request = _hallRequestService.GetById(requestId); + request.comment = comment; + request.Status = ReqestStatus.Rejected; + request.Date=DateTime.Now; + _hallRequestService.UpdateRequest(request); + + return View("Index"); + } + } +} diff --git a/GetSit/Data/AppDBcontext.cs b/GetSit/Data/AppDBcontext.cs index 917ad8a..4392cc8 100644 --- a/GetSit/Data/AppDBcontext.cs +++ b/GetSit/Data/AppDBcontext.cs @@ -98,8 +98,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) public DbSet SpaceWorkingDay { get; set; } public DbSet SystemAdmin { get; set; } public DbSet Title { get; set; } - - + public DbSet<HallRequest> HallRequest { get; set; } } } \ No newline at end of file diff --git a/GetSit/Data/AppDbInitializer.cs b/GetSit/Data/AppDbInitializer.cs index a53fa2b..973ef86 100644 --- a/GetSit/Data/AppDbInitializer.cs +++ b/GetSit/Data/AppDbInitializer.cs @@ -59,7 +59,7 @@ public static void Seed(IApplicationBuilder applicationBuilder) } }); } - context.SaveChanges(); + //context.SaveChanges(); //Space Phone if (!context.SpacePhone.Any()) { diff --git a/GetSit/Data/Services/HallRequestService.cs b/GetSit/Data/Services/HallRequestService.cs new file mode 100644 index 0000000..972171a --- /dev/null +++ b/GetSit/Data/Services/HallRequestService.cs @@ -0,0 +1,44 @@ +using GetSit.Data.enums; +using GetSit.Models; +using Microsoft.EntityFrameworkCore; +using System.Linq.Expressions; + +namespace GetSit.Data.Services +{ + public class HallRequestService : IHallRequestService + { + readonly AppDBcontext _context; + public HallRequestService(AppDBcontext context) + { + _context = context; + } + public void AddRequest(HallRequest request) + { + _context.Add(request); + _context.SaveChanges(); + } + public void DeleteRequest(HallRequest request) + { + _context.Remove(request); + _context.SaveChanges(); + } + public void UpdateRequest(HallRequest request) + { + _context.Update(request); + _context.SaveChanges(); + } + + public List<HallRequest> GetPendingBySpaceId(int spaceId, params Expression<Func<HallRequest, object>>[] includeProperties) + { + IQueryable<HallRequest> query = _context.Set<HallRequest>(); + query = includeProperties.Aggregate(query, (current, includeProperty) => current.Include(includeProperty)); + return query.Where(n => n.Hall.SpaceId == spaceId && n.Status != ReqestStatus.Accepted).ToList(); + } + public HallRequest GetById(int RequestId) + { + var ret=_context.HallRequest.Where(h => h.Id == RequestId).Single(); + return ret; + } + + } +} diff --git a/GetSit/Data/Services/IHallRequestService.cs b/GetSit/Data/Services/IHallRequestService.cs new file mode 100644 index 0000000..cbc3ca7 --- /dev/null +++ b/GetSit/Data/Services/IHallRequestService.cs @@ -0,0 +1,15 @@ +using GetSit.Models; +using System.Linq.Expressions; + +namespace GetSit.Data.Services +{ + public interface IHallRequestService + { + + void AddRequest(HallRequest request); + void DeleteRequest(HallRequest request); + void UpdateRequest(HallRequest request); + HallRequest GetById(int RequestId); + List<HallRequest> GetPendingBySpaceId(int spaceId, params Expression<Func<HallRequest, object>>[] includeProperties); + } +} diff --git a/GetSit/Data/Services/ISpaceHallService.cs b/GetSit/Data/Services/ISpaceHallService.cs index 18bcda4..e809d41 100644 --- a/GetSit/Data/Services/ISpaceHallService.cs +++ b/GetSit/Data/Services/ISpaceHallService.cs @@ -8,6 +8,9 @@ public interface ISpaceHallService:IEntityBaseRepository<SpaceHall> { public Task<IEnumerable<SpaceHall>> GetBySpaceName(String Key); public List<SpaceHall> GetBySpaceId(int spaceId, params Expression<Func<SpaceHall, object>>[] includeProperties); + public void UpdateHall( SpaceHall Hall); + + public List<SpaceHall> GetAcceptedBySpaceId(int spaceId, params Expression<Func<SpaceHall, object>>[] includeProperties); } } diff --git a/GetSit/Data/Services/SpaceHallService.cs b/GetSit/Data/Services/SpaceHallService.cs index cd1090d..383505c 100644 --- a/GetSit/Data/Services/SpaceHallService.cs +++ b/GetSit/Data/Services/SpaceHallService.cs @@ -1,4 +1,5 @@ using GetSit.Data.Base; +using GetSit.Data.enums; using GetSit.Models; using Microsoft.EntityFrameworkCore; using System.Linq.Expressions; @@ -20,11 +21,23 @@ public List<SpaceHall> GetBySpaceId(int spaceId, params Expression<Func<SpaceHal query = includeProperties.Aggregate(query, (current, includeProperty) => current.Include(includeProperty)); return query.Where(n => n.SpaceId == spaceId).ToList(); } + public void UpdateHall(SpaceHall Hall) + { + _context.Update(Hall); + _context.SaveChanges(); + } + public List<SpaceHall> GetAcceptedBySpaceId(int spaceId, params Expression<Func<SpaceHall, object>>[] includeProperties) + { + IQueryable<SpaceHall> query = _context.Set<SpaceHall>(); + query = includeProperties.Aggregate(query, (current, includeProperty) => current.Include(includeProperty)); + return query.Where(n => n.SpaceId == spaceId && n.Status==HallStatus.Accepted).ToList(); + } public async Task<IEnumerable<SpaceHall>> GetBySpaceName(string Key) { var result = await _context.SpaceHall.Include(x => x.Space).Include(y => y.HallPhotos).Where(p => p.Space.Name.Contains(Key)).ToListAsync(); return result; } + } } diff --git a/GetSit/Data/ViewModels/SpaceManagementVM.cs b/GetSit/Data/ViewModels/SpaceManagementVM.cs index 5d1ac31..510a0d6 100644 --- a/GetSit/Data/ViewModels/SpaceManagementVM.cs +++ b/GetSit/Data/ViewModels/SpaceManagementVM.cs @@ -9,5 +9,6 @@ public class SpaceManagementVM public List<SpaceService> Services { get; set; } public List<SpaceEmployee> Employees { get; set; } public List<Booking> Bookings { get; set; } + public List<HallRequest> Requests { get; set; } } } diff --git a/GetSit/Data/enums/HallStatus.cs b/GetSit/Data/enums/HallStatus.cs index c31fdff..732fb93 100644 --- a/GetSit/Data/enums/HallStatus.cs +++ b/GetSit/Data/enums/HallStatus.cs @@ -4,5 +4,6 @@ public enum HallStatus { Pending=1, Accepted + } } diff --git a/GetSit/Data/enums/ReqestStatus.cs b/GetSit/Data/enums/ReqestStatus.cs new file mode 100644 index 0000000..c9709f2 --- /dev/null +++ b/GetSit/Data/enums/ReqestStatus.cs @@ -0,0 +1,9 @@ +namespace GetSit.Data.enums +{ + public enum ReqestStatus + { + Accepted, + Rejected, + pending + } +} diff --git a/GetSit/Data/enums/RequestType.cs b/GetSit/Data/enums/RequestType.cs new file mode 100644 index 0000000..96c33a5 --- /dev/null +++ b/GetSit/Data/enums/RequestType.cs @@ -0,0 +1,8 @@ +namespace GetSit.Data.enums +{ + public enum RequestType + { + Hall=1, + Sevice + } +} diff --git a/GetSit/Migrations/20230608170315_AddHallRequestModel.Designer.cs b/GetSit/Migrations/20230608170315_AddHallRequestModel.Designer.cs new file mode 100644 index 0000000..ef08a4f --- /dev/null +++ b/GetSit/Migrations/20230608170315_AddHallRequestModel.Designer.cs @@ -0,0 +1,1047 @@ +// <auto-generated /> +using System; +using GetSit.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace GetSit.Migrations +{ + [DbContext(typeof(AppDBcontext))] + [Migration("20230608170315_AddHallRequestModel")] + partial class AddHallRequestModel + { + /// <inheritdoc /> + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("GetSit.Models.Booking", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<DateTime>("BookingDate") + .HasColumnType("datetime2"); + + b.Property<int>("BookingStatus") + .HasColumnType("int"); + + b.Property<int>("BookingType") + .HasColumnType("int"); + + b.Property<int>("CustomerId") + .HasColumnType("int"); + + b.Property<DateTime>("DesiredDate") + .HasColumnType("datetime2"); + + b.Property<float>("NumberOfHours") + .HasColumnType("real"); + + b.Property<float>("Paid") + .HasColumnType("real"); + + b.Property<TimeSpan>("StartTime") + .HasColumnType("time(7)"); + + b.Property<float>("TotalCost") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("Booking"); + }); + + modelBuilder.Entity("GetSit.Models.BookingHall", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int>("BookingId") + .HasColumnType("int"); + + b.Property<int>("HallId") + .HasColumnType("int"); + + b.Property<int>("NumberOfUnits") + .HasColumnType("int"); + + b.Property<float>("PricePerUnit") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("BookingId"); + + b.HasIndex("HallId"); + + b.ToTable("BookingHall"); + }); + + modelBuilder.Entity("GetSit.Models.BookingHallService", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int>("BookingHallId") + .HasColumnType("int"); + + b.Property<int>("NumberOfUnits") + .HasColumnType("int"); + + b.Property<float>("PricePerUnit") + .HasColumnType("real"); + + b.Property<int>("ServiceId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BookingHallId"); + + b.HasIndex("ServiceId"); + + b.ToTable("BookingHallService"); + }); + + modelBuilder.Entity("GetSit.Models.Customer", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<DateTime>("Birthdate") + .HasColumnType("datetime2"); + + b.Property<bool>("Blocked") + .HasColumnType("bit"); + + b.Property<string>("City") + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Country") + .HasColumnType("nvarchar(max)"); + + b.Property<int>("CustomerType") + .HasColumnType("int"); + + b.Property<string>("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<int?>("FacultyId") + .HasColumnType("int"); + + b.Property<string>("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<int>("Penality") + .HasColumnType("int"); + + b.Property<string>("PhoneNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("ProfilePictureUrl") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<int?>("TitleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FacultyId"); + + b.HasIndex("TitleId"); + + b.ToTable("Customer"); + }); + + modelBuilder.Entity("GetSit.Models.Faculty", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Faculty"); + }); + + modelBuilder.Entity("GetSit.Models.FavoriteHall", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int>("CustomerId") + .HasColumnType("int"); + + b.Property<int>("HallId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("HallId"); + + b.ToTable("FavoriteHall"); + }); + + modelBuilder.Entity("GetSit.Models.HallFacility", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int>("Facility") + .HasColumnType("int"); + + b.Property<int>("HallId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("HallId"); + + b.ToTable("HallFacility"); + }); + + modelBuilder.Entity("GetSit.Models.HallPhoto", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int>("HallId") + .HasColumnType("int"); + + b.Property<string>("Url") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("HallId"); + + b.ToTable("HallPhoto"); + }); + + modelBuilder.Entity("GetSit.Models.HallRequest", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<DateTime>("Date") + .HasColumnType("datetime2"); + + b.Property<int>("HallId") + .HasColumnType("int"); + + b.Property<int>("Status") + .HasColumnType("int"); + + b.Property<string>("comment") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("HallId"); + + b.ToTable("HallRequest"); + }); + + modelBuilder.Entity("GetSit.Models.Payment", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int>("BookingId") + .HasColumnType("int"); + + b.Property<DateTime>("LastUpdate") + .HasColumnType("datetime2"); + + b.Property<float>("PaidAmount") + .HasColumnType("real"); + + b.Property<int>("Status") + .HasColumnType("int"); + + b.Property<float>("TotalCost") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("BookingId") + .IsUnique(); + + b.ToTable("Payment"); + }); + + modelBuilder.Entity("GetSit.Models.PaymentCard", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<string>("CCV") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("CardNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<int>("CustomerId") + .HasColumnType("int"); + + b.Property<DateTime>("ExpireDate") + .HasColumnType("datetime2"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("PaymentCard"); + }); + + modelBuilder.Entity("GetSit.Models.PaymentDetail", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int?>("BookingHallId") + .HasColumnType("int"); + + b.Property<int?>("BookingHallServiceId") + .HasColumnType("int"); + + b.Property<int>("PaymentId") + .HasColumnType("int"); + + b.Property<int>("Status") + .HasColumnType("int"); + + b.Property<float>("TotalCost") + .HasColumnType("real"); + + b.Property<int>("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BookingHallId") + .IsUnique() + .HasFilter("[BookingHallId] IS NOT NULL"); + + b.HasIndex("BookingHallServiceId") + .IsUnique() + .HasFilter("[BookingHallServiceId] IS NOT NULL"); + + b.HasIndex("PaymentId"); + + b.ToTable("PaymentDetail"); + }); + + modelBuilder.Entity("GetSit.Models.ServicePhoto", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int>("ServiceId") + .HasColumnType("int"); + + b.Property<string>("Url") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServicePhoto"); + }); + + modelBuilder.Entity("GetSit.Models.Space", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<string>("BankAccount") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Bio") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("City") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Country") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("GPSLocation") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<bool>("IsFast") + .HasColumnType("bit"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Street") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Space"); + }); + + modelBuilder.Entity("GetSit.Models.SpaceEmployee", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<DateTime>("Birthdate") + .HasColumnType("datetime2"); + + b.Property<string>("City") + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Country") + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<int>("EmployeeRole") + .HasColumnType("int"); + + b.Property<string>("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("PhoneNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("ProfilePictureUrl") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<int?>("SpaceId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SpaceId"); + + b.ToTable("SpaceEmployee"); + }); + + modelBuilder.Entity("GetSit.Models.SpaceHall", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int>("Capacity") + .HasColumnType("int"); + + b.Property<float>("CostPerHour") + .HasColumnType("real"); + + b.Property<string>("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<int>("SpaceId") + .HasColumnType("int"); + + b.Property<int>("Status") + .HasColumnType("int"); + + b.Property<int>("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SpaceId"); + + b.ToTable("SpaceHall"); + }); + + modelBuilder.Entity("GetSit.Models.SpacePhone", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<string>("PhoneNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<int>("SpaceId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SpaceId"); + + b.ToTable("SpacePhone"); + }); + + modelBuilder.Entity("GetSit.Models.SpacePhoto", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int>("SpaceId") + .HasColumnType("int"); + + b.Property<string>("Url") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("SpaceId"); + + b.ToTable("SpacePhoto"); + }); + + modelBuilder.Entity("GetSit.Models.SpaceService", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<string>("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<float>("Price") + .HasColumnType("real"); + + b.Property<int>("SpaceId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SpaceId"); + + b.ToTable("SpaceService"); + }); + + modelBuilder.Entity("GetSit.Models.SpaceWorkingDay", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<TimeSpan>("ClosingTime") + .HasColumnType("time(7)"); + + b.Property<int>("Day") + .HasColumnType("int"); + + b.Property<TimeSpan>("OpeningTime") + .HasColumnType("time(7)"); + + b.Property<int>("SpaceId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SpaceId"); + + b.ToTable("SpaceWorkingDay"); + }); + + modelBuilder.Entity("GetSit.Models.SystemAdmin", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<int>("AdminRole") + .HasColumnType("int"); + + b.Property<DateTime>("Birthdate") + .HasColumnType("datetime2"); + + b.Property<string>("City") + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Country") + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("PhoneNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property<string>("ProfilePictureUrl") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("SystemAdmin"); + }); + + modelBuilder.Entity("GetSit.Models.Title", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Title"); + }); + + modelBuilder.Entity("GetSit.Models.Booking", b => + { + b.HasOne("GetSit.Models.Customer", "Customer") + .WithMany("Bookings") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("GetSit.Models.BookingHall", b => + { + b.HasOne("GetSit.Models.Booking", "Booking") + .WithMany("BookingHalls") + .HasForeignKey("BookingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("GetSit.Models.SpaceHall", "Hall") + .WithMany("Bookings") + .HasForeignKey("HallId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Booking"); + + b.Navigation("Hall"); + }); + + modelBuilder.Entity("GetSit.Models.BookingHallService", b => + { + b.HasOne("GetSit.Models.BookingHall", "BookingHall") + .WithMany("BookedServices") + .HasForeignKey("BookingHallId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("GetSit.Models.SpaceService", "Service") + .WithMany("Bookings") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("BookingHall"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("GetSit.Models.Customer", b => + { + b.HasOne("GetSit.Models.Faculty", "Faculty") + .WithMany("Customers") + .HasForeignKey("FacultyId"); + + b.HasOne("GetSit.Models.Title", "Title") + .WithMany("Customers") + .HasForeignKey("TitleId"); + + b.Navigation("Faculty"); + + b.Navigation("Title"); + }); + + modelBuilder.Entity("GetSit.Models.FavoriteHall", b => + { + b.HasOne("GetSit.Models.Customer", "customer") + .WithMany("FavoriteHalls") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("GetSit.Models.SpaceHall", "SpaceHall") + .WithMany("FavoriteHalls") + .HasForeignKey("HallId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SpaceHall"); + + b.Navigation("customer"); + }); + + modelBuilder.Entity("GetSit.Models.HallFacility", b => + { + b.HasOne("GetSit.Models.SpaceHall", "Hall") + .WithMany("HallFacilities") + .HasForeignKey("HallId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Hall"); + }); + + modelBuilder.Entity("GetSit.Models.HallPhoto", b => + { + b.HasOne("GetSit.Models.SpaceHall", "Hall") + .WithMany("HallPhotos") + .HasForeignKey("HallId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Hall"); + }); + + modelBuilder.Entity("GetSit.Models.HallRequest", b => + { + b.HasOne("GetSit.Models.SpaceHall", "Hall") + .WithMany("Requests") + .HasForeignKey("HallId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Hall"); + }); + + modelBuilder.Entity("GetSit.Models.Payment", b => + { + b.HasOne("GetSit.Models.Booking", "Booking") + .WithOne("Payment") + .HasForeignKey("GetSit.Models.Payment", "BookingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Booking"); + }); + + modelBuilder.Entity("GetSit.Models.PaymentCard", b => + { + b.HasOne("GetSit.Models.Customer", "Customer") + .WithMany("PaymentCards") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("GetSit.Models.PaymentDetail", b => + { + b.HasOne("GetSit.Models.BookingHall", "BookingHall") + .WithOne("paymentDetail") + .HasForeignKey("GetSit.Models.PaymentDetail", "BookingHallId"); + + b.HasOne("GetSit.Models.BookingHallService", "BookingHallService") + .WithOne("PaymentDetail") + .HasForeignKey("GetSit.Models.PaymentDetail", "BookingHallServiceId"); + + b.HasOne("GetSit.Models.Payment", "Payment") + .WithMany("Details") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BookingHall"); + + b.Navigation("BookingHallService"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("GetSit.Models.ServicePhoto", b => + { + b.HasOne("GetSit.Models.SpaceService", "SpaceService") + .WithMany("ServicePhotos") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SpaceService"); + }); + + modelBuilder.Entity("GetSit.Models.SpaceEmployee", b => + { + b.HasOne("GetSit.Models.Space", "Space") + .WithMany("Employees") + .HasForeignKey("SpaceId"); + + b.Navigation("Space"); + }); + + modelBuilder.Entity("GetSit.Models.SpaceHall", b => + { + b.HasOne("GetSit.Models.Space", "Space") + .WithMany("Halls") + .HasForeignKey("SpaceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Space"); + }); + + modelBuilder.Entity("GetSit.Models.SpacePhone", b => + { + b.HasOne("GetSit.Models.Space", "Space") + .WithMany("Phones") + .HasForeignKey("SpaceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Space"); + }); + + modelBuilder.Entity("GetSit.Models.SpacePhoto", b => + { + b.HasOne("GetSit.Models.Space", "Space") + .WithMany("Photos") + .HasForeignKey("SpaceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Space"); + }); + + modelBuilder.Entity("GetSit.Models.SpaceService", b => + { + b.HasOne("GetSit.Models.Space", "Space") + .WithMany("Services") + .HasForeignKey("SpaceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Space"); + }); + + modelBuilder.Entity("GetSit.Models.SpaceWorkingDay", b => + { + b.HasOne("GetSit.Models.Space", "Space") + .WithMany("WorkingDays") + .HasForeignKey("SpaceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Space"); + }); + + modelBuilder.Entity("GetSit.Models.Booking", b => + { + b.Navigation("BookingHalls"); + + b.Navigation("Payment") + .IsRequired(); + }); + + modelBuilder.Entity("GetSit.Models.BookingHall", b => + { + b.Navigation("BookedServices"); + + b.Navigation("paymentDetail") + .IsRequired(); + }); + + modelBuilder.Entity("GetSit.Models.BookingHallService", b => + { + b.Navigation("PaymentDetail") + .IsRequired(); + }); + + modelBuilder.Entity("GetSit.Models.Customer", b => + { + b.Navigation("Bookings"); + + b.Navigation("FavoriteHalls"); + + b.Navigation("PaymentCards"); + }); + + modelBuilder.Entity("GetSit.Models.Faculty", b => + { + b.Navigation("Customers"); + }); + + modelBuilder.Entity("GetSit.Models.Payment", b => + { + b.Navigation("Details"); + }); + + modelBuilder.Entity("GetSit.Models.Space", b => + { + b.Navigation("Employees"); + + b.Navigation("Halls"); + + b.Navigation("Phones"); + + b.Navigation("Photos"); + + b.Navigation("Services"); + + b.Navigation("WorkingDays"); + }); + + modelBuilder.Entity("GetSit.Models.SpaceHall", b => + { + b.Navigation("Bookings"); + + b.Navigation("FavoriteHalls"); + + b.Navigation("HallFacilities"); + + b.Navigation("HallPhotos"); + + b.Navigation("Requests"); + }); + + modelBuilder.Entity("GetSit.Models.SpaceService", b => + { + b.Navigation("Bookings"); + + b.Navigation("ServicePhotos"); + }); + + modelBuilder.Entity("GetSit.Models.Title", b => + { + b.Navigation("Customers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/GetSit/Migrations/20230608170315_AddHallRequestModel.cs b/GetSit/Migrations/20230608170315_AddHallRequestModel.cs new file mode 100644 index 0000000..4b0764f --- /dev/null +++ b/GetSit/Migrations/20230608170315_AddHallRequestModel.cs @@ -0,0 +1,162 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace GetSit.Migrations +{ + /// <inheritdoc /> + public partial class AddHallRequestModel : Migration + { + /// <inheritdoc /> + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_SpaceEmployee_Space_SpaceId", + table: "SpaceEmployee"); + + migrationBuilder.AlterColumn<string>( + name: "Country", + table: "SystemAdmin", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn<string>( + name: "City", + table: "SystemAdmin", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn<int>( + name: "SpaceId", + table: "SpaceEmployee", + type: "int", + nullable: true, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.AlterColumn<string>( + name: "Country", + table: "SpaceEmployee", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.AlterColumn<string>( + name: "City", + table: "SpaceEmployee", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + + migrationBuilder.CreateTable( + name: "HallRequest", + columns: table => new + { + Id = table.Column<int>(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + comment = table.Column<string>(type: "nvarchar(max)", nullable: true), + Date = table.Column<DateTime>(type: "datetime2", nullable: false), + Status = table.Column<int>(type: "int", nullable: false), + HallId = table.Column<int>(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_HallRequest", x => x.Id); + table.ForeignKey( + name: "FK_HallRequest_SpaceHall_HallId", + column: x => x.HallId, + principalTable: "SpaceHall", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_HallRequest_HallId", + table: "HallRequest", + column: "HallId"); + + migrationBuilder.AddForeignKey( + name: "FK_SpaceEmployee_Space_SpaceId", + table: "SpaceEmployee", + column: "SpaceId", + principalTable: "Space", + principalColumn: "Id"); + } + + /// <inheritdoc /> + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_SpaceEmployee_Space_SpaceId", + table: "SpaceEmployee"); + + migrationBuilder.DropTable( + name: "HallRequest"); + + migrationBuilder.AlterColumn<string>( + name: "Country", + table: "SystemAdmin", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn<string>( + name: "City", + table: "SystemAdmin", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn<int>( + name: "SpaceId", + table: "SpaceEmployee", + type: "int", + nullable: false, + defaultValue: 0, + oldClrType: typeof(int), + oldType: "int", + oldNullable: true); + + migrationBuilder.AlterColumn<string>( + name: "Country", + table: "SpaceEmployee", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AlterColumn<string>( + name: "City", + table: "SpaceEmployee", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + + migrationBuilder.AddForeignKey( + name: "FK_SpaceEmployee_Space_SpaceId", + table: "SpaceEmployee", + column: "SpaceId", + principalTable: "Space", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/GetSit/Migrations/AppDBcontextModelSnapshot.cs b/GetSit/Migrations/AppDBcontextModelSnapshot.cs index b86f984..31544ac 100644 --- a/GetSit/Migrations/AppDBcontextModelSnapshot.cs +++ b/GetSit/Migrations/AppDBcontextModelSnapshot.cs @@ -271,6 +271,35 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("HallId"); b.ToTable("HallPhoto"); + + }); + + modelBuilder.Entity("GetSit.Models.HallRequest", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id")); + + b.Property<DateTime>("Date") + .HasColumnType("datetime2"); + + b.Property<int>("HallId") + .HasColumnType("int"); + + b.Property<int>("Status") + .HasColumnType("int"); + + b.Property<string>("comment") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("HallId"); + + b.ToTable("HallRequest"); + }); modelBuilder.Entity("GetSit.Models.Payment", b => @@ -803,6 +832,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Hall"); }); + modelBuilder.Entity("GetSit.Models.HallRequest", b => + { + b.HasOne("GetSit.Models.SpaceHall", "Hall") + .WithMany("Requests") + .HasForeignKey("HallId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Hall"); + }); + modelBuilder.Entity("GetSit.Models.Payment", b => { b.HasOne("GetSit.Models.Booking", "Booking") @@ -988,6 +1028,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("HallFacilities"); b.Navigation("HallPhotos"); + + b.Navigation("Requests"); }); modelBuilder.Entity("GetSit.Models.SpaceService", b => diff --git a/GetSit/Models/HallRequest.cs b/GetSit/Models/HallRequest.cs new file mode 100644 index 0000000..9c59923 --- /dev/null +++ b/GetSit/Models/HallRequest.cs @@ -0,0 +1,20 @@ +using GetSit.Data.enums; +using GetSit.Models; + +namespace GetSit.Models +{ + public class HallRequest + { + public int Id { get; set; } + public String? comment { get; set; } + public DateTime Date { get; set; } + + public ReqestStatus Status { get; set; } + + public int HallId { get; set; } + public SpaceHall Hall { get; set; } + + + + } +} diff --git a/GetSit/Models/Space.cs b/GetSit/Models/Space.cs index 59aaef4..d914ab6 100644 --- a/GetSit/Models/Space.cs +++ b/GetSit/Models/Space.cs @@ -34,6 +34,8 @@ public class Space : IEntityBase [Required] public ICollection<SpaceHall> Halls { get; set; } public List<SpaceEmployee> Employees { get; set; } - + + + } } diff --git a/GetSit/Models/SpaceHall.cs b/GetSit/Models/SpaceHall.cs index 7821f60..9f88a42 100644 --- a/GetSit/Models/SpaceHall.cs +++ b/GetSit/Models/SpaceHall.cs @@ -10,7 +10,7 @@ public class SpaceHall : IEntityBase [Key] public int Id { get; set; } - [ForeignKey("SpaceId")] + [ForeignKey("SpaceId")] public int SpaceId { get; set; } public Space Space { get; set; } @@ -33,6 +33,8 @@ public class SpaceHall : IEntityBase public List<FavoriteHall> FavoriteHalls { get; set; } [Required] public List<BookingHall> Bookings { get; set; } + public List<HallRequest> Requests { get; set; } + } } diff --git a/GetSit/Models/SpaceService.cs b/GetSit/Models/SpaceService.cs index 36e54fa..4d55aaf 100644 --- a/GetSit/Models/SpaceService.cs +++ b/GetSit/Models/SpaceService.cs @@ -22,5 +22,7 @@ public class SpaceService : IEntityBase public Space Space { get; set; } [Required] public List<BookingHallService> Bookings { get; set; } + + } } diff --git a/GetSit/Program.cs b/GetSit/Program.cs index a1c8d22..10e68f4 100644 --- a/GetSit/Program.cs +++ b/GetSit/Program.cs @@ -65,6 +65,8 @@ builder.Services.AddScoped<ISpaceWorkingDayService, SpaceWorkingDayService>(); builder.Services.AddScoped<ISystemAdminService, SystemAdminService>(); builder.Services.AddScoped<ITitleService, TitleService>(); +builder.Services.AddScoped<IHallRequestService, HallRequestService>(); + var app = builder.Build(); AppDbInitializer.Seed(app); diff --git a/GetSit/Views/Shared/_Layout.cshtml b/GetSit/Views/Shared/_Layout.cshtml index ebdfa74..e1d6006 100644 --- a/GetSit/Views/Shared/_Layout.cshtml +++ b/GetSit/Views/Shared/_Layout.cshtml @@ -26,6 +26,9 @@ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous"> + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script> + + <link href="~/css/Explorer.css" rel="stylesheet" media="all" /> @*pages*@ <link rel="stylesheet" href="~/css/auth.css" asp-append-version="true" /> diff --git a/GetSit/Views/SpaceManagement/Index.cshtml b/GetSit/Views/SpaceManagement/Index.cshtml index f024896..c8a2664 100644 --- a/GetSit/Views/SpaceManagement/Index.cshtml +++ b/GetSit/Views/SpaceManagement/Index.cshtml @@ -43,6 +43,7 @@ <li class="nav-item"><a class="nav-link active" href="#schedule">Schedule</a></li> <li class="nav-item"><a class="nav-link" href="#our-halls">Our Halls</a></li> <li class="nav-item"><a class="nav-link" href="#our-serivces">Our Services</a></li> + <li class="nav-item"><a class="nav-link" href="#our-request">Request</a></li> </ul> </nav> @@ -196,6 +197,39 @@ </a> </div> </section> + <!--Requests--> + <section id="our-request" class="fade-in"> + <div class="container"> + <!-- Content here --> + @foreach (var request in Model.Requests) + { + + <div class="card"> + <div class="card-header"> + <h5 class="card-header">Add new Hall</h5> + </div> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">@request.Hall.Description</p> + @if(request.Status==ReqestStatus.Accepted) + { + <a href="#" class="btn btn-success">Accepted</a> + } + else if (request.Status == ReqestStatus.pending) + { + <button type="button" class="btn btn-secondary">Pending</button> + } + else + { + <button type="button" class="btn btn-danger">Rejected</button> + } + + </div> + </div> + } + </div> + + </section> </div> </div> diff --git a/GetSit/Views/SystemAdmin/Index.cshtml b/GetSit/Views/SystemAdmin/Index.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/GetSit/Views/SystemAdmin/Index.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/GetSit/Views/SystemAdmin/Reqest.cshtml b/GetSit/Views/SystemAdmin/Reqest.cshtml new file mode 100644 index 0000000..e02abfc --- /dev/null +++ b/GetSit/Views/SystemAdmin/Reqest.cshtml @@ -0,0 +1 @@ + diff --git a/GetSit/wwwroot/resources/HallPhotos/Meto_10_0.png b/GetSit/wwwroot/resources/HallPhotos/Meto_10_0.png new file mode 100644 index 0000000..3990bb2 Binary files /dev/null and b/GetSit/wwwroot/resources/HallPhotos/Meto_10_0.png differ diff --git a/GetSit/wwwroot/resources/HallPhotos/Meto_10_1.png b/GetSit/wwwroot/resources/HallPhotos/Meto_10_1.png new file mode 100644 index 0000000..561947a Binary files /dev/null and b/GetSit/wwwroot/resources/HallPhotos/Meto_10_1.png differ diff --git a/GetSit/wwwroot/resources/HallPhotos/Meto_10_2.png b/GetSit/wwwroot/resources/HallPhotos/Meto_10_2.png new file mode 100644 index 0000000..b7a929b Binary files /dev/null and b/GetSit/wwwroot/resources/HallPhotos/Meto_10_2.png differ diff --git a/GetSit/wwwroot/resources/HallPhotos/Meto_10_3.png b/GetSit/wwwroot/resources/HallPhotos/Meto_10_3.png new file mode 100644 index 0000000..f7ec48c Binary files /dev/null and b/GetSit/wwwroot/resources/HallPhotos/Meto_10_3.png differ diff --git a/GetSit/wwwroot/resources/HallPhotos/Meto_9_0.png b/GetSit/wwwroot/resources/HallPhotos/Meto_9_0.png new file mode 100644 index 0000000..3990bb2 Binary files /dev/null and b/GetSit/wwwroot/resources/HallPhotos/Meto_9_0.png differ diff --git a/GetSit/wwwroot/resources/HallPhotos/Meto_9_1.png b/GetSit/wwwroot/resources/HallPhotos/Meto_9_1.png new file mode 100644 index 0000000..af230fe Binary files /dev/null and b/GetSit/wwwroot/resources/HallPhotos/Meto_9_1.png differ diff --git a/GetSit/wwwroot/resources/HallPhotos/Meto_9_2.png b/GetSit/wwwroot/resources/HallPhotos/Meto_9_2.png new file mode 100644 index 0000000..af230fe Binary files /dev/null and b/GetSit/wwwroot/resources/HallPhotos/Meto_9_2.png differ diff --git a/GetSit/wwwroot/resources/HallPhotos/Meto_9_3.png b/GetSit/wwwroot/resources/HallPhotos/Meto_9_3.png new file mode 100644 index 0000000..af6a106 Binary files /dev/null and b/GetSit/wwwroot/resources/HallPhotos/Meto_9_3.png differ