├── HotelBooking.Service ├── DTOs │ ├── AmenityDto.cs │ ├── AmenityForCreationDto.cs │ ├── HotelForCreationDto.cs │ ├── RoomForCreationDto.cs │ ├── UserForCreationDto.cs │ ├── HotelDto.cs │ ├── RoomDto.cs │ ├── ReservationForCreationDto.cs │ ├── ReservationDto.cs │ └── UserDto.cs ├── Helpers │ └── Response.cs ├── Interfaces │ ├── IUserDataService.cs │ ├── IRoomService.cs │ ├── IUserService.cs │ ├── IHotelService.cs │ ├── IAmenityService.cs │ └── IReservationService.cs ├── HotelBooking.Service.csproj ├── Mappers │ └── MapperProfile.cs └── Services │ ├── UserDataService.cs │ ├── AmenityService.cs │ ├── RoomService.cs │ ├── UserService.cs │ ├── HotelService.cs │ └── ReservationService.cs ├── HotelBooking.Domain ├── Enums │ └── PaymentType.cs ├── Entities │ ├── Amenity.cs │ ├── RoomsAmenity.cs │ ├── Hotel.cs │ ├── Room.cs │ ├── User.cs │ ├── Reservation.cs │ ├── Data.cs │ └── UserData.cs ├── Common │ └── Auditable.cs └── HotelBooking.Domain.csproj ├── HotelBooking.DAL ├── IRepositories │ ├── IRoomRepository.cs │ ├── IUserRepository.cs │ ├── IHotelRepository.cs │ ├── IAmenityRepository.cs │ ├── IReservationRepository.cs │ └── IRoomsAmenityRepository.cs ├── Context │ └── AppDbContext.cs ├── HotelBooking.DAL.csproj ├── Repositories │ ├── AmenityRepository.cs │ ├── HotelRepository.cs │ ├── ReservationRepository.cs │ ├── RoomRepository.cs │ ├── UserRepository.cs │ └── RoomsAmenityRepository.cs └── Migrations │ ├── 20230322130939_Hotel.cs │ ├── 20230322080026_HotelBooking.cs │ ├── 20230322080026_HotelBooking.Designer.cs │ ├── AppDbContextModelSnapshot.cs │ └── 20230322130939_Hotel.Designer.cs ├── HotelBooking ├── Program.cs └── HotelBooking.Presentation.csproj ├── README.md ├── .gitattributes ├── HotelBooking.sln └── .gitignore /HotelBooking.Service/DTOs/AmenityDto.cs: -------------------------------------------------------------------------------- 1 | namespace HotelBooking.Service.DTOs; 2 | 3 | public class AmenityDto 4 | { 5 | 6 | public string Name { get; set; } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /HotelBooking.Domain/Enums/PaymentType.cs: -------------------------------------------------------------------------------- 1 | namespace HotelBooking.Domain.Enums; 2 | 3 | public enum PaymentType : byte 4 | { 5 | Cash = 10, 6 | Uzcard = 20, 7 | Xumo = 30, 8 | Payme = 40, 9 | Click = 50 10 | } 11 | -------------------------------------------------------------------------------- /HotelBooking.Domain/Entities/Amenity.cs: -------------------------------------------------------------------------------- 1 | 2 | 3 | using HotelBooking.Domain.Common; 4 | 5 | namespace HotelBooking.Domain.Entities; 6 | 7 | public class Amenity:Auditable 8 | { 9 | 10 | public string Name { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /HotelBooking.Service/Helpers/Response.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | 3 | namespace HotelBooking.Service.Helpers; 4 | 5 | public class Response 6 | { 7 | public int StatusCode { get; set; } 8 | public string Message { get; set; } 9 | public TResult Value { get; set; } 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /HotelBooking.Domain/Common/Auditable.cs: -------------------------------------------------------------------------------- 1 | 2 | 3 | namespace HotelBooking.Domain.Common; 4 | 5 | public class Auditable 6 | { 7 | public long Id { get; set; } 8 | public DateTime CreatedAt { get; set; } 9 | public DateTime? UpdatedAt { get; set; } 10 | public bool IsActive { get; set; } = true; 11 | } 12 | -------------------------------------------------------------------------------- /HotelBooking.Domain/Entities/RoomsAmenity.cs: -------------------------------------------------------------------------------- 1 | 2 | 3 | using HotelBooking.Domain.Common; 4 | 5 | namespace HotelBooking.Domain.Entities; 6 | 7 | public class RoomsAmenity:Auditable 8 | { 9 | public long Id { get; set; } 10 | public Room Room { get; set; } 11 | public Amenity Amenity { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /HotelBooking.Service/DTOs/AmenityForCreationDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace HotelBooking.Service.DTOs 8 | { 9 | public class AmenityForCreationDto 10 | { 11 | public string Name { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /HotelBooking.Service/DTOs/HotelForCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace HotelBooking.Service.DTOs; 2 | 3 | public class HotelForCreationDto 4 | { 5 | public string Name { get; set; } 6 | public string Country { get; set; } 7 | public string City { get; set; } 8 | public string Street { get; set; } 9 | public string Phone { get; set; } 10 | 11 | } 12 | 13 | -------------------------------------------------------------------------------- /HotelBooking.Domain/Entities/Hotel.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Common; 2 | 3 | namespace HotelBooking.Domain.Entities; 4 | 5 | public class Hotel : Auditable 6 | { 7 | public string Name { get; set; } 8 | public string Country { get; set; } 9 | public string City { get; set; } 10 | public string Street { get; set; } 11 | public string Phone { get; set; } 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /HotelBooking.Domain/HotelBooking.Domain.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /HotelBooking.Domain/Entities/Room.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Common; 2 | 3 | namespace HotelBooking.Domain.Entities; 4 | 5 | public class Room : Auditable 6 | { 7 | public Hotel Hotel { get; set; } 8 | public decimal Price { get; set; } 9 | public string Status { get; set; } 10 | public string Type { get; set; } 11 | public int Capacity { get; set; } 12 | public string Desription { get; set; } 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /HotelBooking.Service/DTOs/RoomForCreationDto.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | 3 | namespace HotelBooking.Service.DTOs; 4 | 5 | public class RoomForCreationDto 6 | { 7 | public Hotel Hotel { get; set; } 8 | public decimal Price { get; set; } 9 | public string Status { get; set; } 10 | public string Type { get; set; } 11 | public int Capacity { get; set; } 12 | public string Desription { get; set; } 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /HotelBooking.Service/Interfaces/IUserDataService.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using HotelBooking.Service.Helpers; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace HotelBooking.Service.Interfaces 10 | { 11 | public interface IUserDataService 12 | { 13 | Task> SearchUserAsync(String type); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /HotelBooking.Service/DTOs/UserForCreationDto.cs: -------------------------------------------------------------------------------- 1 | namespace HotelBooking.Service.DTOs; 2 | 3 | public class UserForCreationDto 4 | { 5 | 6 | public int FirstName { get; set; } 7 | public int LastName { get; set; } 8 | public string Username { get; set; } 9 | public string Role { get; set; } 10 | public string Phone { get; set; } 11 | public string CardNumber { get; set; } 12 | public decimal CardMoney { get; set; } 13 | public string Password { get; set; } 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /HotelBooking.Service/DTOs/HotelDto.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace HotelBooking.Service.DTOs 8 | { 9 | public class HotelDto 10 | { 11 | public string Name { get; set; } 12 | public string Country { get; set; } 13 | public string City { get; set; } 14 | public string Street { get; set; } 15 | public string Phone { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /HotelBooking.Domain/Entities/User.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Common; 2 | 3 | namespace HotelBooking.Domain.Entities; 4 | 5 | public class User : Auditable 6 | { 7 | public int FirstName { get; set; } 8 | public int LastName { get; set; } 9 | public string Username { get; set; } 10 | public string Phone { get; set; } 11 | public string Password { get; set; } 12 | public string Role { get; set; } 13 | public string CardNumber { get; set; } 14 | public decimal CardMoney { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /HotelBooking.Service/DTOs/RoomDto.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HotelBooking.Service.DTOs 9 | { 10 | public class RoomDto 11 | { 12 | public Hotel Hotel { get; set; } 13 | public decimal Price { get; set; } 14 | public string Status { get; set; } 15 | public string Type { get; set; } 16 | public int Capacity { get; set; } 17 | public string Desription { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /HotelBooking.Service/Interfaces/IRoomService.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using HotelBooking.Service.DTOs; 3 | using HotelBooking.Service.Helpers; 4 | 5 | namespace HotelBooking.Service.Interfaces; 6 | 7 | public interface IRoomService 8 | { 9 | ValueTask> AddRoomAsync(RoomDto roomDto); 10 | ValueTask> ModifyRoomAsync(int id, RoomDto roomDto); 11 | ValueTask> DeleteRoomAsync(int id); 12 | ValueTask> GetRoomByIdAsync(int id); 13 | ValueTask>> GetAllRoomAsync(); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /HotelBooking.Service/Interfaces/IUserService.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using HotelBooking.Service.DTOs; 3 | using HotelBooking.Service.Helpers; 4 | 5 | namespace HotelBooking.Service.Interfaces; 6 | 7 | public interface IUserService 8 | { 9 | ValueTask> AddUserAsync(UserDto userDto); 10 | ValueTask> ModifyUserAsync(int id, UserDto userDto); 11 | ValueTask> DeleteUserAsync(int id); 12 | ValueTask> GetUserByIdAsync(int id); 13 | ValueTask>> GetAllUserAsync(); 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /HotelBooking.DAL/IRepositories/IRoomRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HotelBooking.DAL.IRepositories 9 | { 10 | public interface IRoomRepository 11 | { 12 | ValueTask InsertRoomAsync(Room room); 13 | ValueTask UpdateRoomAsync(Room room); 14 | ValueTask DeleteRoomAsync(int id); 15 | ValueTask SelectRoomAsync(int id); 16 | IQueryable SelectAllAsync(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HotelBooking.DAL/IRepositories/IUserRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HotelBooking.DAL.IRepositories 9 | { 10 | public interface IUserRepository 11 | { 12 | ValueTask InsertUserAsync(User user); 13 | ValueTask UpdateUserAsync(User user); 14 | ValueTask DeleteUserAsync(int id); 15 | ValueTask SelectUserAsync(int id); 16 | IQueryable SelectAllAsync(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HotelBooking.Service/Interfaces/IHotelService.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using HotelBooking.Service.DTOs; 3 | using HotelBooking.Service.Helpers; 4 | 5 | namespace HotelBooking.Service.Interfaces; 6 | 7 | public interface IHotelService 8 | { 9 | ValueTask> AddHotelAsync(HotelDto hotelDto); 10 | ValueTask> ModifyHotelAsync(int id, HotelDto hotelDto); 11 | ValueTask> DeleteHotelAsync(int id); 12 | ValueTask> GetHotelByIdAsync(int id); 13 | ValueTask>> GetAllHotelAsync(); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /HotelBooking.DAL/IRepositories/IHotelRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HotelBooking.DAL.IRepositories 9 | { 10 | public interface IHotelRepository 11 | { 12 | ValueTask InsertHotelAsync(Hotel hotel); 13 | ValueTask UpdateHotelAsync(Hotel hotel); 14 | ValueTask DeleteHotelAsync(int id); 15 | ValueTask SelectHotelAsync(int id); 16 | IQueryable SelectAllAsync(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HotelBooking.Service/DTOs/ReservationForCreationDto.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | 3 | namespace HotelBooking.Service.DTOs; 4 | 5 | public class ReservationForCreationDto 6 | { 7 | public User User { get; set; } 8 | public Room Room { get; set; } 9 | public string FirstName { get; set; } 10 | public string LastName { get; set; } 11 | public string Note { get; set; } 12 | public decimal Payment { get; set; } 13 | public string PaymentType { get; set; } 14 | public string Status { get; set; } 15 | public DateTime ChackIn { get; set; } 16 | public DateTime ChackOut { get; set; } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /HotelBooking.Domain/Entities/Reservation.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Common; 2 | 3 | namespace HotelBooking.Domain.Entities; 4 | 5 | public class Reservation : Auditable 6 | { 7 | public User User { get; set; } 8 | public Room Room { get; set; } 9 | public string FirstName { get; set; } 10 | public string LastName { get; set; } 11 | public string Note { get; set; } 12 | public decimal Payment { get; set; } 13 | public string PaymentType { get; set; } 14 | public string Status { get; set; } 15 | public DateTime ChackIn { get; set; } 16 | public DateTime ChackOut { get; set; } 17 | } 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /HotelBooking.DAL/IRepositories/IAmenityRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HotelBooking.DAL.IRepositories 9 | { 10 | public interface IAmenityRepository 11 | { 12 | ValueTask InsertAmenityAsync(Amenity amenity); 13 | ValueTask UpdateAmenityAsync(Amenity amenity); 14 | ValueTask DeleteAmenityAsync(int id); 15 | ValueTask SelectAmenityAsync(int id); 16 | IQueryable SelectAllAsync(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HotelBooking.Service/Interfaces/IAmenityService.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using HotelBooking.Service.DTOs; 3 | using HotelBooking.Service.Helpers; 4 | 5 | namespace HotelBooking.Service.Interfaces; 6 | 7 | public interface IAmenityService 8 | { 9 | ValueTask> AddAmenityAsync(AmenityDto amenityDto); 10 | ValueTask> ModifyAmenityAsync(int id, AmenityDto amenityDto); 11 | ValueTask> DeleteAmenityAsync(int id); 12 | ValueTask> GetAmenityByIdAsync(int id); 13 | ValueTask>> GetAllAmenityAsync(); 14 | } 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /HotelBooking.Domain/Entities/Data.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HotelBooking.Domain.Entities; 9 | 10 | public class Data 11 | { 12 | 13 | [JsonProperty("page")] 14 | public int Page{ get; set; } 15 | [JsonProperty("per_page")] 16 | public int PerPage { get; set; } 17 | [JsonProperty("total")] 18 | public int Total { get; set; } 19 | [JsonProperty("total_page")] 20 | public int TotalPage { get; set; } 21 | [JsonProperty("data")] 22 | public List UserDatas { get; set; } 23 | } 24 | -------------------------------------------------------------------------------- /HotelBooking.Service/HotelBooking.Service.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /HotelBooking.Domain/Entities/UserData.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Text.Json.Serialization; 7 | using System.Threading.Tasks; 8 | 9 | namespace HotelBooking.Domain.Entities 10 | { 11 | public class UserData 12 | { 13 | [JsonProperty("id")] 14 | public int Id { get; set; } 15 | [JsonProperty("email")] 16 | public string Email { get; set; } 17 | [JsonProperty("first_name")] 18 | public string FirstName { get; set; } 19 | [JsonProperty("last_name")] 20 | public string LastName { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /HotelBooking.DAL/IRepositories/IReservationRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HotelBooking.DAL.IRepositories 9 | { 10 | public interface IReservationRepository 11 | { 12 | ValueTask InsertReservationAsync(Reservation reservation); 13 | ValueTask UpdateReservationAsync(Reservation reservation); 14 | ValueTask DeleteReservationAsync(int id); 15 | ValueTask SelectReservationAsync(int id); 16 | IQueryable SelectAllAsync(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HotelBooking.Service/Interfaces/IReservationService.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using HotelBooking.Service.DTOs; 3 | using HotelBooking.Service.Helpers; 4 | 5 | namespace HotelBooking.Service.Interfaces; 6 | 7 | public interface IReservationService 8 | { 9 | ValueTask> AddReservationAsync(ReservationDto reservationDto); 10 | ValueTask> ModifyReservationAsync(int id, ReservationDto reservationDto); 11 | ValueTask> DeleteReservationAsync(int id); 12 | ValueTask> GetReservationByIdAsync(int id); 13 | ValueTask>> GetAllReservationAsync(); 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /HotelBooking/Program.cs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | using HotelBooking.Domain.Entities; 5 | using Newtonsoft.Json; 6 | 7 | using (var client = new HttpClient()) 8 | { 9 | var url = "https://reqres.in/api/users?page=2"; 10 | var responce = await client.GetAsync(url); 11 | if (responce.IsSuccessStatusCode) 12 | { 13 | var json = await responce.Content.ReadAsStringAsync(); 14 | var result = JsonConvert.DeserializeObject(json); 15 | 16 | Console.WriteLine(result.Total); 17 | Console.WriteLine(result.Page); 18 | Console.WriteLine(result.PerPage); 19 | 20 | foreach (var item in result.UserDatas) 21 | Console.WriteLine(item.FirstName); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /HotelBooking.Service/DTOs/ReservationDto.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HotelBooking.Service.DTOs 9 | { 10 | public class ReservationDto 11 | { 12 | public User User { get; set; } 13 | public Room Room { get; set; } 14 | public string FirstName { get; set; } 15 | public string LastName { get; set; } 16 | public decimal Payment { get; set; } 17 | public string PaymentType { get; set; } 18 | public DateTime ChackIn { get; set; } 19 | public DateTime ChackOut { get; set; } 20 | } 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /HotelBooking/HotelBooking.Presentation.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /HotelBooking.DAL/IRepositories/IRoomsAmenityRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HotelBooking.DAL.IRepositories 9 | { 10 | public interface IRoomsAmenityRepository 11 | { 12 | ValueTask InsertRoomsAmenityAsync(RoomsAmenity roomsAmenity); 13 | ValueTask UpdateRoomsAmenityAsync(RoomsAmenity roomsAmenity); 14 | ValueTask DeleteRoomsAmenityAsync(int id); 15 | ValueTask SelectRoomsAmenityAsync(Predicate roomsAmenity); 16 | IQueryable SelectAllAsync(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HotelBooking.Service/Mappers/MapperProfile.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using HotelBooking.Domain.Entities; 3 | using HotelBooking.Service.DTOs; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace HotelBooking.Service.Mappers 11 | { 12 | public class MapperProfile : Profile 13 | { 14 | public MapperProfile() 15 | { 16 | CreateMap().ReverseMap(); 17 | CreateMap().ReverseMap(); 18 | CreateMap().ReverseMap(); 19 | CreateMap().ReverseMap(); 20 | CreateMap().ReverseMap(); 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /HotelBooking.Service/DTOs/UserDto.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HotelBooking.Service.DTOs 9 | { 10 | public class UserDto 11 | { 12 | public int FirstName { get; set; } 13 | public int LastName { get; set; } 14 | public string Phone { get; set; } 15 | public string Role { get; set; } 16 | public string Username { get; set; } 17 | 18 | public static explicit operator UserDto(User user) 19 | { 20 | return new UserDto 21 | { 22 | FirstName = user.FirstName, 23 | LastName = user.LastName, 24 | Phone = user.Phone, 25 | Role = user.Role, 26 | Username = user.Username, 27 | }; 28 | } 29 | 30 | 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Context/AppDbContext.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using Microsoft.EntityFrameworkCore; 3 | 4 | namespace HotelBooking.DAL.Configurations 5 | { 6 | public class AppDbContext:DbContext 7 | { 8 | public DbSet Amenities { get; set; } 9 | public DbSet Hotels { get; set; } 10 | public DbSet Reservations { get; set; } 11 | public DbSet Rooms { get; set; } 12 | public DbSet RoomsAmenities { get; set; } 13 | public DbSet Users { get; set; } 14 | protected override void OnConfiguring( 15 | DbContextOptionsBuilder optionsBuilder) 16 | { 17 | string path = "Server = (localdb)\\MSSQLLocalDB;" + 18 | "Database = HotelBooking" + 19 | "Trusted_Connection = True"; 20 | optionsBuilder.UseSqlServer(path); 21 | } 22 | } 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /HotelBooking.DAL/HotelBooking.DAL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | Library 8 | 9 | 10 | 11 | 12 | all 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | 15 | 16 | 17 | all 18 | runtime; build; native; contentfiles; analyzers; buildtransitive 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /HotelBooking.Service/Services/UserDataService.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.Domain.Entities; 2 | using HotelBooking.Service.Helpers; 3 | using HotelBooking.Service.Interfaces; 4 | using Newtonsoft.Json; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace HotelBooking.Service.Services 12 | { 13 | public class UserDataService : IUserDataService 14 | { 15 | 16 | public async Task> SearchUserAsync(string type) 17 | { 18 | HttpClient client = new HttpClient(); 19 | HttpResponseMessage message = await client.GetAsync($"https://arbeitnow.com/api/job-board-api{type}"); 20 | string jsonString = await message.Content.ReadAsStringAsync(); 21 | 22 | try 23 | { 24 | var entity = JsonConvert.DeserializeObject(jsonString); 25 | return new Response() 26 | { 27 | StatusCode = 200, 28 | Message = "Ok", 29 | Value = entity 30 | }; 31 | } 32 | catch (Exception ex) 33 | { 34 | return new Response() 35 | { 36 | StatusCode = 200, 37 | Message = ex.Message, 38 | Value = null 39 | }; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Repositories/AmenityRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.DAL.Configurations; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.Domain.Entities; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | 7 | namespace HotelBooking.DAL.Repositories; 8 | 9 | public class AmenityRepository : IAmenityRepository 10 | { 11 | private readonly AppDbContext appDbContext = new AppDbContext(); 12 | public async ValueTask DeleteAmenityAsync(int id) 13 | { 14 | Amenity entity = 15 | await this.appDbContext.Amenities.FirstOrDefaultAsync(amenity => amenity.Id.Equals(id)); 16 | if (entity is null) 17 | return false; 18 | 19 | this.appDbContext.Amenities.Remove(entity); 20 | await this.appDbContext.SaveChangesAsync(); 21 | return true; 22 | } 23 | 24 | public async ValueTask InsertAmenityAsync(Amenity amenity) 25 | { 26 | EntityEntry entity = await this.appDbContext.Amenities.AddAsync(amenity); 27 | await appDbContext.SaveChangesAsync(); 28 | return entity.Entity; 29 | } 30 | public async ValueTask UpdateAmenityAsync(Amenity amenity) 31 | { 32 | EntityEntry entity = this.appDbContext.Amenities.Update(amenity); 33 | await appDbContext.SaveChangesAsync(); 34 | return entity.Entity; 35 | } 36 | public IQueryable SelectAllAsync() => 37 | this.appDbContext.Amenities.Where(amenity => amenity.IsActive); 38 | 39 | 40 | 41 | public async ValueTask SelectAmenityAsync(int id) => 42 | await appDbContext.Amenities.FirstOrDefaultAsync(s => s.Id.Equals(id)); 43 | } 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HotelBooking 2 | application for remote hotel booking 3 | ![image](https://user-images.githubusercontent.com/124185901/220857409-b59aa258-eea5-457f-b810-4a4a3f2f0575.png) 4 | 5 | 6 | 7 | # HotelBooking 8 | 9 | HotelBooking is a .NET-based web application that allows users to book hotel rooms online from the comfort of their homes. This application simplifies the process of searching for and booking hotel rooms, making it easier and more convenient for customers. 10 | 11 | ## Getting Started 12 | 13 | To get started with HotelBooking, follow these steps: 14 | 15 | 1. Clone the repository: `git clone https://github.com/your-username/HotelBooking.git` 16 | 2. Open the solution file in Visual Studio. 17 | 3. Build the project. 18 | 4. Run the application. 19 | 20 | ## Features 21 | 22 | HotelBooking includes the following features: 23 | 24 | - User registration and authentication. 25 | - Hotel catalog with detailed descriptions and images. 26 | - Search and filter functionality for finding specific hotels. 27 | - Room selection and booking. 28 | - Payment integration with popular payment gateways. 29 | - User dashboard for managing bookings and payments. 30 | - Admin panel for managing hotels, rooms, and bookings. 31 | 32 | ## Technologies Used 33 | 34 | HotelBooking is built using the following technologies: 35 | 36 | - .NET Framework 37 | - C# 38 | - ASP.NET MVC 39 | - Entity Framework 40 | - HTML/CSS 41 | - Bootstrap 42 | - jQuery 43 | - SQL Server 44 | 45 | ## Contributing 46 | 47 | Contributions to HotelBooking are welcome and encouraged! To contribute, follow these steps: 48 | 49 | 1. Fork the repository. 50 | 2. Create a new branch. 51 | 3. Make your changes. 52 | 4. Submit a pull request. 53 | 54 | ## License 55 | 56 | This project is licensed under the MIT License. See the LICENSE file for details. 57 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Migrations/20230322130939_Hotel.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace HotelBooking.DAL.Migrations 6 | { 7 | public partial class Hotel : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.RenameColumn( 12 | name: "UserName", 13 | table: "Users", 14 | newName: "Username"); 15 | 16 | migrationBuilder.AddColumn( 17 | name: "FirstName", 18 | table: "Users", 19 | type: "int", 20 | nullable: false, 21 | defaultValue: 0); 22 | 23 | migrationBuilder.AddColumn( 24 | name: "LastName", 25 | table: "Users", 26 | type: "int", 27 | nullable: false, 28 | defaultValue: 0); 29 | 30 | migrationBuilder.AddColumn( 31 | name: "Phone", 32 | table: "Users", 33 | type: "nvarchar(max)", 34 | nullable: true); 35 | } 36 | 37 | protected override void Down(MigrationBuilder migrationBuilder) 38 | { 39 | migrationBuilder.DropColumn( 40 | name: "FirstName", 41 | table: "Users"); 42 | 43 | migrationBuilder.DropColumn( 44 | name: "LastName", 45 | table: "Users"); 46 | 47 | migrationBuilder.DropColumn( 48 | name: "Phone", 49 | table: "Users"); 50 | 51 | migrationBuilder.RenameColumn( 52 | name: "Username", 53 | table: "Users", 54 | newName: "UserName"); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Repositories/HotelRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.DAL.Configurations; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.Domain.Entities; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | 7 | 8 | namespace HotelBooking.DAL.Repositories; 9 | 10 | public class HotelRepository : IHotelRepository 11 | { 12 | private readonly AppDbContext appDbContext = new AppDbContext(); 13 | public async ValueTask DeleteHotelAsync(int id) 14 | { 15 | Hotel entity = 16 | await this.appDbContext.Hotels.FirstOrDefaultAsync(hotel => hotel.Id.Equals(id)); 17 | if (entity is null) 18 | return false; 19 | 20 | this.appDbContext.Hotels.Remove(entity); 21 | await this.appDbContext.SaveChangesAsync(); 22 | return true; 23 | } 24 | 25 | public async ValueTask InsertHotelAsync(Hotel hotel) 26 | { 27 | EntityEntry entity = await this.appDbContext.Hotels.AddAsync(hotel); 28 | await appDbContext.SaveChangesAsync(); 29 | return entity.Entity; 30 | } 31 | 32 | public IQueryable SelectAllAsync() => 33 | this.appDbContext.Hotels.Where(hotel => hotel.IsActive); 34 | 35 | public async ValueTask SelectHotelAsync(Predicate predicate) => 36 | await this.appDbContext.Hotels.Where(hotel => hotel.IsActive).FirstOrDefaultAsync(hotel => predicate(hotel)); 37 | 38 | public async ValueTask SelectHotelAsync(int id) => 39 | await appDbContext.Hotels.FirstOrDefaultAsync(s => s.Id.Equals(id)); 40 | 41 | public async ValueTask UpdateHotelAsync(Hotel hotel) 42 | { 43 | EntityEntry entity = this.appDbContext.Hotels.Update(hotel); 44 | await appDbContext.SaveChangesAsync(); 45 | return entity.Entity; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Repositories/ReservationRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.DAL.Configurations; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.Domain.Entities; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace HotelBooking.DAL.Repositories 13 | { 14 | public class ReservationRepository : IReservationRepository 15 | { 16 | private readonly AppDbContext appDbContext = new AppDbContext(); 17 | public async ValueTask DeleteReservationAsync(int id) 18 | { 19 | Reservation entity = 20 | await this.appDbContext.Reservations.FirstOrDefaultAsync(reservation => reservation.Id.Equals(id)); 21 | if (entity is null) 22 | return false; 23 | 24 | this.appDbContext.Reservations.Remove(entity); 25 | await this.appDbContext.SaveChangesAsync(); 26 | return true; 27 | } 28 | 29 | public async ValueTask InsertReservationAsync(Reservation reservation) 30 | { 31 | EntityEntry entity = await this.appDbContext.Reservations.AddAsync(reservation); 32 | await appDbContext.SaveChangesAsync(); 33 | return entity.Entity; 34 | } 35 | 36 | public IQueryable SelectAllAsync() => 37 | this.appDbContext.Reservations.Where(reservation => reservation.IsActive); 38 | 39 | 40 | public async ValueTask SelectReservationAsync(int id) => 41 | await appDbContext.Reservations.FirstOrDefaultAsync(s => s.Id.Equals(id)); 42 | 43 | public async ValueTask UpdateReservationAsync(Reservation reservation) 44 | { 45 | EntityEntry entity = this.appDbContext.Reservations.Update(reservation); 46 | await appDbContext.SaveChangesAsync(); 47 | return entity.Entity; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Repositories/RoomRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.DAL.Configurations; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.Domain.Entities; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace HotelBooking.DAL.Repositories 13 | { 14 | public class RoomRepository : IRoomRepository 15 | { 16 | private readonly AppDbContext appDbContext = new AppDbContext(); 17 | public async ValueTask DeleteRoomAsync(int id) 18 | { 19 | Room entity = 20 | await this.appDbContext.Rooms.FirstOrDefaultAsync(rooms => rooms.Id.Equals(id)); 21 | if (entity is null) 22 | return false; 23 | 24 | this.appDbContext.Rooms.Remove(entity); 25 | await this.appDbContext.SaveChangesAsync(); 26 | return true; 27 | } 28 | 29 | public async ValueTask InsertRoomAsync(Room room) 30 | { 31 | EntityEntry entity = await this.appDbContext.Rooms.AddAsync(room); 32 | await appDbContext.SaveChangesAsync(); 33 | return entity.Entity; 34 | } 35 | 36 | public IQueryable SelectAllAsync() => 37 | this.appDbContext.Rooms.Where(rooms => rooms.IsActive); 38 | 39 | public async ValueTask SelectRoomAsync(Predicate predicate) => 40 | await this.appDbContext.Rooms.Where(rooms => rooms.IsActive).FirstOrDefaultAsync(rooms => predicate(rooms)); 41 | 42 | public async ValueTask SelectRoomAsync(int id) => 43 | await appDbContext.Rooms.FirstOrDefaultAsync(s => s.Id.Equals(id)); 44 | 45 | public async ValueTask UpdateRoomAsync(Room room) 46 | { 47 | EntityEntry entity = this.appDbContext.Rooms.Update(room); 48 | await appDbContext.SaveChangesAsync(); 49 | return entity.Entity; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Repositories/UserRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.DAL.Configurations; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.Domain.Entities; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace HotelBooking.DAL.Repositories 13 | { 14 | public class UserRepository : IUserRepository 15 | { 16 | private readonly AppDbContext appDbContext = new AppDbContext(); 17 | 18 | public async ValueTask DeleteUserAsync(int id) 19 | { 20 | User entity = 21 | await this.appDbContext.Users.FirstOrDefaultAsync(user => user.Id.Equals(id)); 22 | if (entity is null) 23 | return false; 24 | 25 | this.appDbContext.Users.Remove(entity); 26 | await this.appDbContext.SaveChangesAsync(); 27 | return true; 28 | } 29 | 30 | public async ValueTask InsertUserAsync(User user) 31 | { 32 | EntityEntry entity = await this.appDbContext.Users.AddAsync(user); 33 | await appDbContext.SaveChangesAsync(); 34 | return entity.Entity; 35 | } 36 | 37 | public IQueryable SelectAllAsync() => 38 | this.appDbContext.Users.Where(user => user.IsActive); 39 | 40 | 41 | 42 | public async ValueTask SelectUserAsync(Predicate predicate) => 43 | await this.appDbContext.Users.Where(user => user.IsActive).FirstOrDefaultAsync(user => predicate(user)); 44 | 45 | public async ValueTask SelectUserAsync(int id) => 46 | await appDbContext.Users.FirstOrDefaultAsync(s => s.Id.Equals(id)); 47 | 48 | public async ValueTask UpdateUserAsync(User user) 49 | { 50 | EntityEntry entity = this.appDbContext.Users.Update(user); 51 | await appDbContext.SaveChangesAsync(); 52 | return entity.Entity; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Repositories/RoomsAmenityRepository.cs: -------------------------------------------------------------------------------- 1 | using HotelBooking.DAL.Configurations; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.Domain.Entities; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.ChangeTracking; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace HotelBooking.DAL.Repositories 13 | { 14 | public class RoomsAmenityRepository : IRoomsAmenityRepository 15 | { 16 | private readonly AppDbContext appDbContext = new AppDbContext(); 17 | public async ValueTask DeleteRoomsAmenityAsync(int id) 18 | { 19 | RoomsAmenity entity = 20 | await this.appDbContext.RoomsAmenities.FirstOrDefaultAsync(roomsAmenity => roomsAmenity.Id.Equals(id)); 21 | if (entity is null) 22 | return false; 23 | 24 | this.appDbContext.RoomsAmenities.Remove(entity); 25 | await this.appDbContext.SaveChangesAsync(); 26 | return true; 27 | } 28 | 29 | public async ValueTask InsertRoomsAmenityAsync(RoomsAmenity roomsAmenity) 30 | { 31 | EntityEntry entity = await this.appDbContext.RoomsAmenities.AddAsync(roomsAmenity); 32 | await appDbContext.SaveChangesAsync(); 33 | return entity.Entity; 34 | } 35 | 36 | public IQueryable SelectAllAsync() => 37 | this.appDbContext.RoomsAmenities.Where(roomsAmenity => roomsAmenity.IsActive); 38 | 39 | public async ValueTask SelectRoomsAmenityAsync(Predicate predicate) => 40 | await this.appDbContext.RoomsAmenities.Where(roomsAmenity => roomsAmenity.IsActive).FirstOrDefaultAsync(reservation => predicate(reservation)); 41 | 42 | 43 | public async ValueTask UpdateRoomsAmenityAsync(RoomsAmenity roomsAmenity) 44 | { 45 | EntityEntry entity = this.appDbContext.RoomsAmenities.Update(roomsAmenity); 46 | await appDbContext.SaveChangesAsync(); 47 | return entity.Entity; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /HotelBooking.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33122.133 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotelBooking.Presentation", "HotelBooking\HotelBooking.Presentation.csproj", "{48E79C41-62EF-4D68-97E5-122585CBB29F}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotelBooking.DAL", "HotelBooking.DAL\HotelBooking.DAL.csproj", "{0B42107E-6DC6-44FD-B860-BC186D55D1A6}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotelBooking.Domain", "HotelBooking.Domain\HotelBooking.Domain.csproj", "{ECB1BF01-C799-4161-88E4-6864AC8CFFD2}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotelBooking.Service", "HotelBooking.Service\HotelBooking.Service.csproj", "{0BC941EE-A2B3-4976-AA45-373028CFE434}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {48E79C41-62EF-4D68-97E5-122585CBB29F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {48E79C41-62EF-4D68-97E5-122585CBB29F}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {48E79C41-62EF-4D68-97E5-122585CBB29F}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {48E79C41-62EF-4D68-97E5-122585CBB29F}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {0B42107E-6DC6-44FD-B860-BC186D55D1A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {0B42107E-6DC6-44FD-B860-BC186D55D1A6}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {0B42107E-6DC6-44FD-B860-BC186D55D1A6}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {0B42107E-6DC6-44FD-B860-BC186D55D1A6}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {ECB1BF01-C799-4161-88E4-6864AC8CFFD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {ECB1BF01-C799-4161-88E4-6864AC8CFFD2}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {ECB1BF01-C799-4161-88E4-6864AC8CFFD2}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {ECB1BF01-C799-4161-88E4-6864AC8CFFD2}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {0BC941EE-A2B3-4976-AA45-373028CFE434}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {0BC941EE-A2B3-4976-AA45-373028CFE434}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {0BC941EE-A2B3-4976-AA45-373028CFE434}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {0BC941EE-A2B3-4976-AA45-373028CFE434}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {D75DB644-3343-4537-B812-BEAD091CC68B} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /HotelBooking.Service/Services/AmenityService.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.DAL.Repositories; 4 | using HotelBooking.Domain.Entities; 5 | using HotelBooking.Service.DTOs; 6 | using HotelBooking.Service.Helpers; 7 | using HotelBooking.Service.Interfaces; 8 | 9 | namespace HotelBooking.Service.Services; 10 | 11 | public class AmenityService : IAmenityService 12 | { 13 | private readonly IAmenityRepository amenityRepository = new AmenityRepository(); 14 | private readonly IMapper mapper; 15 | 16 | public AmenityService() 17 | { 18 | 19 | } 20 | public AmenityService(IMapper mapper) 21 | { 22 | this.mapper = mapper; 23 | } 24 | public async ValueTask> AddAmenityAsync(AmenityDto amenityDto) 25 | { 26 | var amenity = amenityRepository.SelectAllAsync() 27 | .FirstOrDefault(x => x.Name.ToLower() == amenityDto.Name.ToLower()); 28 | if (amenity is null) 29 | { 30 | var newAmentity = mapper.Map(amenityDto); 31 | var newResult = await amenityRepository.InsertAmenityAsync(newAmentity); 32 | var mappedAmentity = mapper.Map(newResult); 33 | 34 | return new Response() 35 | { 36 | StatusCode = 200, 37 | Message = "Success", 38 | Value = mappedAmentity 39 | }; 40 | } 41 | return new Response() 42 | { 43 | StatusCode = 403, 44 | Message = "Category is alredy exists!", 45 | Value = null 46 | }; 47 | } 48 | 49 | public async ValueTask> DeleteAmenityAsync(int id) 50 | { 51 | var category = await amenityRepository.SelectAmenityAsync(id); 52 | if (category is null) 53 | { 54 | return new Response() 55 | { 56 | StatusCode = 404, 57 | Message = "NOT FOUND", 58 | Value = false 59 | }; 60 | } 61 | await amenityRepository.DeleteAmenityAsync(id); 62 | return new Response() 63 | { 64 | StatusCode = 200, 65 | Message = "Success", 66 | Value = true 67 | }; 68 | } 69 | 70 | public async ValueTask>> GetAllAmenityAsync() 71 | { 72 | var amenity = amenityRepository.SelectAllAsync(); 73 | var mappedAmenity = mapper.Map>(amenity); 74 | return new Response>() 75 | { 76 | StatusCode = 200, 77 | Message = "Success", 78 | Value = mappedAmenity 79 | }; 80 | } 81 | 82 | public async ValueTask> GetAmenityByIdAsync(int id) 83 | { 84 | var amenity = await amenityRepository.SelectAmenityAsync(id); 85 | if (amenity is null) 86 | { 87 | return new Response() 88 | { 89 | StatusCode = 404, 90 | Message = "NOT FOUND", 91 | Value = null 92 | }; 93 | } 94 | var mappedAmenity = mapper.Map(amenity); 95 | return new Response() 96 | { 97 | StatusCode = 200, 98 | Message = "Success", 99 | Value = mappedAmenity 100 | }; 101 | } 102 | 103 | public async ValueTask> ModifyAmenityAsync(int id, AmenityDto amenityDto) 104 | { 105 | var amenity = await amenityRepository.SelectAmenityAsync(id); 106 | if (amenity is null) 107 | { 108 | return new Response() 109 | { 110 | StatusCode = 404, 111 | Message = "NOT FOUND", 112 | Value = null 113 | }; 114 | } 115 | amenity.Name = amenityDto.Name; 116 | amenity.UpdatedAt = DateTime.Now; 117 | 118 | await amenityRepository.UpdateAmenityAsync(amenity); 119 | var mappedAmenity = mapper.Map(amenity); 120 | 121 | return new Response() 122 | { 123 | StatusCode = 200, 124 | Message = "Success", 125 | Value = mappedAmenity 126 | }; 127 | 128 | 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /HotelBooking.Service/Services/RoomService.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.DAL.Repositories; 4 | using HotelBooking.Domain.Entities; 5 | using HotelBooking.Service.DTOs; 6 | using HotelBooking.Service.Helpers; 7 | using HotelBooking.Service.Interfaces; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Text; 12 | using System.Threading.Tasks; 13 | 14 | namespace HotelBooking.Service.Services 15 | { 16 | public class RoomService : IRoomService 17 | { 18 | private readonly IRoomRepository roomRepository = new RoomRepository(); 19 | private readonly IMapper mapper; 20 | public RoomService() 21 | { 22 | 23 | } 24 | public RoomService(IMapper mapper) 25 | { 26 | this.mapper = mapper; 27 | } 28 | 29 | public async ValueTask> AddRoomAsync(RoomDto roomDto) 30 | { 31 | var room = roomRepository.SelectAllAsync() 32 | .FirstOrDefault(x => x.Status == roomDto.Status); 33 | if (room is null) 34 | { 35 | var newRoom = mapper.Map(roomRepository); 36 | var newResult = await roomRepository.InsertRoomAsync(newRoom); 37 | var mappedRoom = mapper.Map(newResult); 38 | 39 | return new Response() 40 | { 41 | StatusCode = 200, 42 | Message = "Success", 43 | Value = mappedRoom 44 | }; 45 | } 46 | return new Response() 47 | { 48 | StatusCode = 403, 49 | Message = "Category is alredy exists!", 50 | Value = null 51 | }; 52 | } 53 | 54 | public async ValueTask> DeleteRoomAsync(int id) 55 | { 56 | var room = await roomRepository.SelectRoomAsync(id); 57 | if (room is null) 58 | { 59 | return new Response() 60 | { 61 | StatusCode = 404, 62 | Message = "NOT FOUND", 63 | Value = false 64 | }; 65 | } 66 | await roomRepository.DeleteRoomAsync(id); 67 | return new Response() 68 | { 69 | StatusCode = 200, 70 | Message = "Success", 71 | Value = true 72 | }; 73 | } 74 | 75 | public async ValueTask>> GetAllRoomAsync() 76 | { 77 | var room = roomRepository.SelectAllAsync(); 78 | var mappedRoom = mapper.Map>(room); 79 | return new Response>() 80 | { 81 | StatusCode = 200, 82 | Message = "Success", 83 | Value = mappedRoom 84 | }; 85 | } 86 | 87 | public async ValueTask> GetRoomByIdAsync(int id) 88 | { 89 | var room = await roomRepository.SelectRoomAsync(id); 90 | if (room is null) 91 | { 92 | return new Response() 93 | { 94 | StatusCode = 404, 95 | Message = "NOT FOUND", 96 | Value = null 97 | }; 98 | } 99 | var mappedRoom = mapper.Map(room); 100 | return new Response() 101 | { 102 | StatusCode = 200, 103 | Message = "Success", 104 | Value = mappedRoom 105 | }; 106 | } 107 | 108 | public async ValueTask> ModifyRoomAsync(int id, RoomDto roomDto) 109 | { 110 | var room = await roomRepository.SelectRoomAsync(id); 111 | if (room is null) 112 | { 113 | return new Response() 114 | { 115 | StatusCode = 404, 116 | Message = "NOT FOUND", 117 | Value = null 118 | }; 119 | } 120 | room.Desription = roomDto.Desription; 121 | room.Status = roomDto.Status; 122 | room.Capacity = roomDto.Capacity; 123 | room.Price = roomDto.Price; 124 | room.Type = roomDto.Type; 125 | room.Hotel = roomDto.Hotel; 126 | room.UpdatedAt = DateTime.Now; 127 | 128 | await roomRepository.UpdateRoomAsync(room); 129 | var mappedRoom = mapper.Map(room); 130 | 131 | return new Response() 132 | { 133 | StatusCode = 200, 134 | Message = "Success", 135 | Value = mappedRoom 136 | }; 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /HotelBooking.Service/Services/UserService.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.DAL.Repositories; 4 | using HotelBooking.Domain.Entities; 5 | using HotelBooking.Service.DTOs; 6 | using HotelBooking.Service.Helpers; 7 | using HotelBooking.Service.Interfaces; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Text; 12 | using System.Threading.Tasks; 13 | 14 | namespace HotelBooking.Service.Services 15 | { 16 | public class UserService : IUserService 17 | { 18 | private readonly IUserRepository userRepository = new UserRepository(); 19 | private readonly IMapper mapper; 20 | public UserService() 21 | { 22 | 23 | } 24 | public UserService(IMapper mapper) 25 | { 26 | this.mapper = mapper; 27 | } 28 | public async ValueTask> AddUserAsync(UserDto userDto) 29 | { 30 | 31 | var room = userRepository.SelectAllAsync() 32 | .FirstOrDefault(x => x.Username.ToLower() == userDto.Username.ToLower()); 33 | if (room is null) 34 | { 35 | var newUser = mapper.Map(userRepository); 36 | var newResult = await userRepository.InsertUserAsync(newUser); 37 | var mappedUser = mapper.Map(newResult); 38 | 39 | return new Response() 40 | { 41 | StatusCode = 200, 42 | Message = "Success", 43 | Value = mappedUser 44 | }; 45 | } 46 | return new Response() 47 | { 48 | StatusCode = 403, 49 | Message = "Category is alredy exists!", 50 | Value = null 51 | }; 52 | } 53 | 54 | public async ValueTask> DeleteUserAsync(int id) 55 | { 56 | var user = await userRepository.SelectUserAsync(id); 57 | if (user is null) 58 | { 59 | return new Response() 60 | { 61 | StatusCode = 404, 62 | Message = "NOT FOUND", 63 | Value = false 64 | }; 65 | } 66 | await userRepository.DeleteUserAsync(id); 67 | return new Response() 68 | { 69 | StatusCode = 200, 70 | Message = "Success", 71 | Value = true 72 | }; 73 | } 74 | 75 | public async ValueTask>> GetAllUserAsync() 76 | { 77 | var user = userRepository.SelectAllAsync(); 78 | var mappedUser = mapper.Map>(user); 79 | return new Response>() 80 | { 81 | StatusCode = 200, 82 | Message = "Success", 83 | Value = mappedUser 84 | }; 85 | } 86 | 87 | public async ValueTask> GetUserByIdAsync(int id) 88 | { 89 | var user = await userRepository.SelectUserAsync(id); 90 | if (user is null) 91 | { 92 | return new Response() 93 | { 94 | StatusCode = 404, 95 | Message = "NOT FOUND", 96 | Value = null 97 | }; 98 | } 99 | var mappedUSer = mapper.Map(user); 100 | return new Response() 101 | { 102 | StatusCode = 200, 103 | Message = "Success", 104 | Value = mappedUSer 105 | }; 106 | } 107 | 108 | public async ValueTask> ModifyUserAsync(int id, UserDto userDto) 109 | { 110 | var user = await userRepository.SelectUserAsync(id); 111 | if (user is null) 112 | { 113 | return new Response() 114 | { 115 | StatusCode = 404, 116 | Message = "NOT FOUND", 117 | Value = null 118 | }; 119 | } 120 | user.LastName = userDto.LastName; 121 | user.FirstName = userDto.FirstName; 122 | user.Username = userDto.Username; 123 | user.Phone = userDto.Phone; 124 | user.Role = userDto.Role; 125 | user.UpdatedAt = DateTime.Now; 126 | 127 | 128 | await userRepository.UpdateUserAsync(user); 129 | var mappedRoom = mapper.Map(user); 130 | 131 | return new Response() 132 | { 133 | StatusCode = 200, 134 | Message = "Success", 135 | Value = mappedRoom 136 | }; 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /HotelBooking.Service/Services/HotelService.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.DAL.Repositories; 4 | using HotelBooking.Domain.Entities; 5 | using HotelBooking.Service.DTOs; 6 | using HotelBooking.Service.Helpers; 7 | using HotelBooking.Service.Interfaces; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Text; 12 | using System.Threading.Tasks; 13 | 14 | namespace HotelBooking.Service.Services 15 | { 16 | public class HotelService : IHotelService 17 | { 18 | private readonly IHotelRepository hotelRepository = new HotelRepository(); 19 | private readonly IMapper mapper; 20 | public HotelService() 21 | { 22 | 23 | } 24 | public HotelService(IMapper mapper) 25 | { 26 | this.mapper = mapper; 27 | } 28 | public async ValueTask> AddHotelAsync(HotelDto hotelDto) 29 | { 30 | var hotel = hotelRepository.SelectAllAsync() 31 | .FirstOrDefault(x => x.Name.ToLower() == hotelDto.Name.ToLower()); 32 | if (hotel is null) 33 | { 34 | var newhotel = mapper.Map(hotelDto); 35 | var newResult = await hotelRepository.InsertHotelAsync(newhotel); 36 | var mappedHotel = mapper.Map(newResult); 37 | 38 | return new Response() 39 | { 40 | StatusCode = 200, 41 | Message = "Success", 42 | Value = mappedHotel 43 | }; 44 | } 45 | return new Response() 46 | { 47 | StatusCode = 403, 48 | Message = "Category is alredy exists!", 49 | Value = null 50 | }; 51 | } 52 | 53 | public async ValueTask> DeleteHotelAsync(int id) 54 | { 55 | var category = await hotelRepository.SelectHotelAsync(id); 56 | if (category is null) 57 | { 58 | return new Response() 59 | { 60 | StatusCode = 404, 61 | Message = "NOT FOUND", 62 | Value = false 63 | }; 64 | } 65 | await hotelRepository.DeleteHotelAsync(id); 66 | return new Response() 67 | { 68 | StatusCode = 200, 69 | Message = "Success", 70 | Value = true 71 | }; 72 | } 73 | 74 | public async ValueTask>> GetAllHotelAsync() 75 | { 76 | var hotel = hotelRepository.SelectAllAsync(); 77 | var mappedHotel = mapper.Map>(hotel); 78 | return new Response>() 79 | { 80 | StatusCode = 200, 81 | Message = "Success", 82 | Value = mappedHotel 83 | }; 84 | } 85 | 86 | public async ValueTask> GetHotelByIdAsync(int id) 87 | { 88 | var hotel = await hotelRepository.SelectHotelAsync(id); 89 | if (hotel is null) 90 | { 91 | return new Response() 92 | { 93 | StatusCode = 404, 94 | Message = "NOT FOUND", 95 | Value = null 96 | }; 97 | } 98 | var mappedhotel = mapper.Map(hotel); 99 | return new Response() 100 | { 101 | StatusCode = 200, 102 | Message = "Success", 103 | Value = mappedhotel 104 | }; 105 | } 106 | 107 | public async ValueTask> ModifyHotelAsync(int id, HotelDto hotelDto) 108 | { 109 | var hotel = await hotelRepository.SelectHotelAsync(id); 110 | if (hotel is null) 111 | { 112 | return new Response() 113 | { 114 | StatusCode = 404, 115 | Message = "NOT FOUND", 116 | Value = null 117 | }; 118 | } 119 | hotel.Name = hotelDto.Name; 120 | hotel.Street = hotelDto.Street; 121 | hotel.City = hotelDto.City; 122 | hotel.Country = hotelDto.Country; 123 | hotel.UpdatedAt = DateTime.Now; 124 | hotel.Phone = hotelDto.Phone; 125 | 126 | 127 | 128 | await hotelRepository.UpdateHotelAsync(hotel); 129 | var mappedAmenity = mapper.Map(hotel); 130 | 131 | return new Response() 132 | { 133 | StatusCode = 200, 134 | Message = "Success", 135 | Value = mappedAmenity 136 | }; 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /HotelBooking.Service/Services/ReservationService.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using HotelBooking.DAL.IRepositories; 3 | using HotelBooking.DAL.Repositories; 4 | using HotelBooking.Domain.Entities; 5 | using HotelBooking.Service.DTOs; 6 | using HotelBooking.Service.Helpers; 7 | using HotelBooking.Service.Interfaces; 8 | using Microsoft.EntityFrameworkCore.Migrations.Operations; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | using System.Threading.Tasks; 14 | 15 | namespace HotelBooking.Service.Services 16 | { 17 | public class ReservationService : IReservationService 18 | { 19 | private readonly IReservationRepository reservationRepository = new ReservationRepository(); 20 | private readonly IMapper mapper; 21 | public ReservationService() 22 | { 23 | 24 | } 25 | public ReservationService(IMapper mapper) 26 | { 27 | this.mapper = mapper; 28 | } 29 | public async ValueTask> AddReservationAsync(ReservationDto reservationDto) 30 | { 31 | var reservation = reservationRepository.SelectAllAsync() 32 | .FirstOrDefault(x => x.User == reservationDto.User); 33 | if (reservation is null) 34 | { 35 | var newhotel = mapper.Map(reservationDto); 36 | var newResult = await reservationRepository.InsertReservationAsync(newhotel); 37 | var mappedHotel = mapper.Map(newResult); 38 | 39 | return new Response() 40 | { 41 | StatusCode = 200, 42 | Message = "Success", 43 | Value = mappedHotel 44 | }; 45 | } 46 | return new Response() 47 | { 48 | StatusCode = 403, 49 | Message = "Category is alredy exists!", 50 | Value = null 51 | }; 52 | } 53 | 54 | public async ValueTask> DeleteReservationAsync(int id) 55 | { 56 | var reservation = await reservationRepository.SelectReservationAsync(id); 57 | if (reservation is null) 58 | { 59 | return new Response() 60 | { 61 | StatusCode = 404, 62 | Message = "NOT FOUND", 63 | Value = false 64 | }; 65 | } 66 | await reservationRepository.DeleteReservationAsync(id); 67 | return new Response() 68 | { 69 | StatusCode = 200, 70 | Message = "Success", 71 | Value = true 72 | }; 73 | } 74 | 75 | public async ValueTask>> GetAllReservationAsync() 76 | { 77 | var reservation = reservationRepository.SelectAllAsync(); 78 | var mappedReservation = mapper.Map>(reservation); 79 | return new Response>() 80 | { 81 | StatusCode = 200, 82 | Message = "Success", 83 | Value = mappedReservation 84 | }; 85 | } 86 | 87 | public async ValueTask> GetReservationByIdAsync(int id) 88 | { 89 | var reservation = await reservationRepository.SelectReservationAsync(id); 90 | if (reservation is null) 91 | { 92 | return new Response() 93 | { 94 | StatusCode = 404, 95 | Message = "NOT FOUND", 96 | Value = null 97 | }; 98 | } 99 | var mappedReservation = mapper.Map(reservation); 100 | return new Response() 101 | { 102 | StatusCode = 200, 103 | Message = "Success", 104 | Value = mappedReservation 105 | }; 106 | } 107 | 108 | public async ValueTask> ModifyReservationAsync(int id, ReservationDto reservationDto) 109 | { 110 | var reservation = await reservationRepository.SelectReservationAsync(id); 111 | if (reservation is null) 112 | { 113 | return new Response() 114 | { 115 | StatusCode = 404, 116 | Message = "NOT FOUND", 117 | Value = null 118 | }; 119 | } 120 | reservation.LastName = reservationDto.LastName; 121 | reservation.FirstName = reservationDto.FirstName; 122 | reservation.Room = reservationDto.Room; 123 | reservation.Note = reservation.Note; 124 | reservation.Payment = reservationDto.Payment; 125 | reservation.PaymentType = reservationDto.PaymentType; 126 | reservation.User = reservationDto.User; 127 | reservation.ChackIn = DateTime.Now; 128 | 129 | await reservationRepository.UpdateReservationAsync(reservation); 130 | var mappedReservation = mapper.Map(reservation); 131 | 132 | return new Response() 133 | { 134 | StatusCode = 200, 135 | Message = "Success", 136 | Value = mappedReservation 137 | }; 138 | } 139 | } 140 | } 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /HotelBooking.DAL/Migrations/20230322080026_HotelBooking.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | #nullable disable 5 | 6 | namespace HotelBooking.DAL.Migrations 7 | { 8 | public partial class HotelBooking : Migration 9 | { 10 | protected override void Up(MigrationBuilder migrationBuilder) 11 | { 12 | migrationBuilder.CreateTable( 13 | name: "Amenities", 14 | columns: table => new 15 | { 16 | Id = table.Column(type: "bigint", nullable: false) 17 | .Annotation("SqlServer:Identity", "1, 1"), 18 | Name = table.Column(type: "nvarchar(max)", nullable: true), 19 | CreatedAt = table.Column(type: "datetime2", nullable: false), 20 | UpdatedAt = table.Column(type: "datetime2", nullable: true), 21 | IsActive = table.Column(type: "bit", nullable: false) 22 | }, 23 | constraints: table => 24 | { 25 | table.PrimaryKey("PK_Amenities", x => x.Id); 26 | }); 27 | 28 | migrationBuilder.CreateTable( 29 | name: "Hotels", 30 | columns: table => new 31 | { 32 | Id = table.Column(type: "bigint", nullable: false) 33 | .Annotation("SqlServer:Identity", "1, 1"), 34 | Name = table.Column(type: "nvarchar(max)", nullable: true), 35 | Country = table.Column(type: "nvarchar(max)", nullable: true), 36 | City = table.Column(type: "nvarchar(max)", nullable: true), 37 | Street = table.Column(type: "nvarchar(max)", nullable: true), 38 | Phone = table.Column(type: "nvarchar(max)", nullable: true), 39 | CreatedAt = table.Column(type: "datetime2", nullable: false), 40 | UpdatedAt = table.Column(type: "datetime2", nullable: true), 41 | IsActive = table.Column(type: "bit", nullable: false) 42 | }, 43 | constraints: table => 44 | { 45 | table.PrimaryKey("PK_Hotels", x => x.Id); 46 | }); 47 | 48 | migrationBuilder.CreateTable( 49 | name: "Users", 50 | columns: table => new 51 | { 52 | Id = table.Column(type: "bigint", nullable: false) 53 | .Annotation("SqlServer:Identity", "1, 1"), 54 | UserName = table.Column(type: "nvarchar(max)", nullable: true), 55 | Password = table.Column(type: "nvarchar(max)", nullable: true), 56 | Role = table.Column(type: "nvarchar(max)", nullable: true), 57 | CardNumber = table.Column(type: "nvarchar(max)", nullable: true), 58 | CardMoney = table.Column(type: "decimal(18,2)", nullable: false), 59 | CreatedAt = table.Column(type: "datetime2", nullable: false), 60 | UpdatedAt = table.Column(type: "datetime2", nullable: true), 61 | IsActive = table.Column(type: "bit", nullable: false) 62 | }, 63 | constraints: table => 64 | { 65 | table.PrimaryKey("PK_Users", x => x.Id); 66 | }); 67 | 68 | migrationBuilder.CreateTable( 69 | name: "Rooms", 70 | columns: table => new 71 | { 72 | Id = table.Column(type: "bigint", nullable: false) 73 | .Annotation("SqlServer:Identity", "1, 1"), 74 | HotelId = table.Column(type: "bigint", nullable: true), 75 | Price = table.Column(type: "decimal(18,2)", nullable: false), 76 | Status = table.Column(type: "nvarchar(max)", nullable: true), 77 | Type = table.Column(type: "nvarchar(max)", nullable: true), 78 | Capacity = table.Column(type: "int", nullable: false), 79 | Desription = table.Column(type: "nvarchar(max)", nullable: true), 80 | CreatedAt = table.Column(type: "datetime2", nullable: false), 81 | UpdatedAt = table.Column(type: "datetime2", nullable: true), 82 | IsActive = table.Column(type: "bit", nullable: false) 83 | }, 84 | constraints: table => 85 | { 86 | table.PrimaryKey("PK_Rooms", x => x.Id); 87 | table.ForeignKey( 88 | name: "FK_Rooms_Hotels_HotelId", 89 | column: x => x.HotelId, 90 | principalTable: "Hotels", 91 | principalColumn: "Id"); 92 | }); 93 | 94 | migrationBuilder.CreateTable( 95 | name: "Reservations", 96 | columns: table => new 97 | { 98 | Id = table.Column(type: "bigint", nullable: false) 99 | .Annotation("SqlServer:Identity", "1, 1"), 100 | UserId = table.Column(type: "bigint", nullable: true), 101 | RoomId = table.Column(type: "bigint", nullable: true), 102 | FirstName = table.Column(type: "nvarchar(max)", nullable: true), 103 | LastName = table.Column(type: "nvarchar(max)", nullable: true), 104 | Note = table.Column(type: "nvarchar(max)", nullable: true), 105 | Payment = table.Column(type: "decimal(18,2)", nullable: false), 106 | PaymentType = table.Column(type: "nvarchar(max)", nullable: true), 107 | Status = table.Column(type: "nvarchar(max)", nullable: true), 108 | ChackIn = table.Column(type: "datetime2", nullable: false), 109 | ChackOut = table.Column(type: "datetime2", nullable: false), 110 | CreatedAt = table.Column(type: "datetime2", nullable: false), 111 | UpdatedAt = table.Column(type: "datetime2", nullable: true), 112 | IsActive = table.Column(type: "bit", nullable: false) 113 | }, 114 | constraints: table => 115 | { 116 | table.PrimaryKey("PK_Reservations", x => x.Id); 117 | table.ForeignKey( 118 | name: "FK_Reservations_Rooms_RoomId", 119 | column: x => x.RoomId, 120 | principalTable: "Rooms", 121 | principalColumn: "Id"); 122 | table.ForeignKey( 123 | name: "FK_Reservations_Users_UserId", 124 | column: x => x.UserId, 125 | principalTable: "Users", 126 | principalColumn: "Id"); 127 | }); 128 | 129 | migrationBuilder.CreateTable( 130 | name: "RoomsAmenities", 131 | columns: table => new 132 | { 133 | Id = table.Column(type: "bigint", nullable: false) 134 | .Annotation("SqlServer:Identity", "1, 1"), 135 | RoomId = table.Column(type: "bigint", nullable: true), 136 | AmenityId = table.Column(type: "bigint", nullable: true), 137 | CreatedAt = table.Column(type: "datetime2", nullable: false), 138 | UpdatedAt = table.Column(type: "datetime2", nullable: true), 139 | IsActive = table.Column(type: "bit", nullable: false) 140 | }, 141 | constraints: table => 142 | { 143 | table.PrimaryKey("PK_RoomsAmenities", x => x.Id); 144 | table.ForeignKey( 145 | name: "FK_RoomsAmenities_Amenities_AmenityId", 146 | column: x => x.AmenityId, 147 | principalTable: "Amenities", 148 | principalColumn: "Id"); 149 | table.ForeignKey( 150 | name: "FK_RoomsAmenities_Rooms_RoomId", 151 | column: x => x.RoomId, 152 | principalTable: "Rooms", 153 | principalColumn: "Id"); 154 | }); 155 | 156 | migrationBuilder.CreateIndex( 157 | name: "IX_Reservations_RoomId", 158 | table: "Reservations", 159 | column: "RoomId"); 160 | 161 | migrationBuilder.CreateIndex( 162 | name: "IX_Reservations_UserId", 163 | table: "Reservations", 164 | column: "UserId"); 165 | 166 | migrationBuilder.CreateIndex( 167 | name: "IX_Rooms_HotelId", 168 | table: "Rooms", 169 | column: "HotelId"); 170 | 171 | migrationBuilder.CreateIndex( 172 | name: "IX_RoomsAmenities_AmenityId", 173 | table: "RoomsAmenities", 174 | column: "AmenityId"); 175 | 176 | migrationBuilder.CreateIndex( 177 | name: "IX_RoomsAmenities_RoomId", 178 | table: "RoomsAmenities", 179 | column: "RoomId"); 180 | } 181 | 182 | protected override void Down(MigrationBuilder migrationBuilder) 183 | { 184 | migrationBuilder.DropTable( 185 | name: "Reservations"); 186 | 187 | migrationBuilder.DropTable( 188 | name: "RoomsAmenities"); 189 | 190 | migrationBuilder.DropTable( 191 | name: "Users"); 192 | 193 | migrationBuilder.DropTable( 194 | name: "Amenities"); 195 | 196 | migrationBuilder.DropTable( 197 | name: "Rooms"); 198 | 199 | migrationBuilder.DropTable( 200 | name: "Hotels"); 201 | } 202 | } 203 | } 204 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Migrations/20230322080026_HotelBooking.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using HotelBooking.DAL.Configurations; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | #nullable disable 11 | 12 | namespace HotelBooking.DAL.Migrations 13 | { 14 | [DbContext(typeof(AppDbContext))] 15 | [Migration("20230322080026_HotelBooking")] 16 | partial class HotelBooking 17 | { 18 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 19 | { 20 | #pragma warning disable 612, 618 21 | modelBuilder 22 | .HasAnnotation("ProductVersion", "6.0.12") 23 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 24 | 25 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); 26 | 27 | modelBuilder.Entity("HotelBooking.Domain.Entities.Amenity", b => 28 | { 29 | b.Property("Id") 30 | .ValueGeneratedOnAdd() 31 | .HasColumnType("bigint"); 32 | 33 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 34 | 35 | b.Property("CreatedAt") 36 | .HasColumnType("datetime2"); 37 | 38 | b.Property("IsActive") 39 | .HasColumnType("bit"); 40 | 41 | b.Property("Name") 42 | .HasColumnType("nvarchar(max)"); 43 | 44 | b.Property("UpdatedAt") 45 | .HasColumnType("datetime2"); 46 | 47 | b.HasKey("Id"); 48 | 49 | b.ToTable("Amenities"); 50 | }); 51 | 52 | modelBuilder.Entity("HotelBooking.Domain.Entities.Hotel", b => 53 | { 54 | b.Property("Id") 55 | .ValueGeneratedOnAdd() 56 | .HasColumnType("bigint"); 57 | 58 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 59 | 60 | b.Property("City") 61 | .HasColumnType("nvarchar(max)"); 62 | 63 | b.Property("Country") 64 | .HasColumnType("nvarchar(max)"); 65 | 66 | b.Property("CreatedAt") 67 | .HasColumnType("datetime2"); 68 | 69 | b.Property("IsActive") 70 | .HasColumnType("bit"); 71 | 72 | b.Property("Name") 73 | .HasColumnType("nvarchar(max)"); 74 | 75 | b.Property("Phone") 76 | .HasColumnType("nvarchar(max)"); 77 | 78 | b.Property("Street") 79 | .HasColumnType("nvarchar(max)"); 80 | 81 | b.Property("UpdatedAt") 82 | .HasColumnType("datetime2"); 83 | 84 | b.HasKey("Id"); 85 | 86 | b.ToTable("Hotels"); 87 | }); 88 | 89 | modelBuilder.Entity("HotelBooking.Domain.Entities.Reservation", b => 90 | { 91 | b.Property("Id") 92 | .ValueGeneratedOnAdd() 93 | .HasColumnType("bigint"); 94 | 95 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 96 | 97 | b.Property("ChackIn") 98 | .HasColumnType("datetime2"); 99 | 100 | b.Property("ChackOut") 101 | .HasColumnType("datetime2"); 102 | 103 | b.Property("CreatedAt") 104 | .HasColumnType("datetime2"); 105 | 106 | b.Property("FirstName") 107 | .HasColumnType("nvarchar(max)"); 108 | 109 | b.Property("IsActive") 110 | .HasColumnType("bit"); 111 | 112 | b.Property("LastName") 113 | .HasColumnType("nvarchar(max)"); 114 | 115 | b.Property("Note") 116 | .HasColumnType("nvarchar(max)"); 117 | 118 | b.Property("Payment") 119 | .HasColumnType("decimal(18,2)"); 120 | 121 | b.Property("PaymentType") 122 | .HasColumnType("nvarchar(max)"); 123 | 124 | b.Property("RoomId") 125 | .HasColumnType("bigint"); 126 | 127 | b.Property("Status") 128 | .HasColumnType("nvarchar(max)"); 129 | 130 | b.Property("UpdatedAt") 131 | .HasColumnType("datetime2"); 132 | 133 | b.Property("UserId") 134 | .HasColumnType("bigint"); 135 | 136 | b.HasKey("Id"); 137 | 138 | b.HasIndex("RoomId"); 139 | 140 | b.HasIndex("UserId"); 141 | 142 | b.ToTable("Reservations"); 143 | }); 144 | 145 | modelBuilder.Entity("HotelBooking.Domain.Entities.Room", b => 146 | { 147 | b.Property("Id") 148 | .ValueGeneratedOnAdd() 149 | .HasColumnType("bigint"); 150 | 151 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 152 | 153 | b.Property("Capacity") 154 | .HasColumnType("int"); 155 | 156 | b.Property("CreatedAt") 157 | .HasColumnType("datetime2"); 158 | 159 | b.Property("Desription") 160 | .HasColumnType("nvarchar(max)"); 161 | 162 | b.Property("HotelId") 163 | .HasColumnType("bigint"); 164 | 165 | b.Property("IsActive") 166 | .HasColumnType("bit"); 167 | 168 | b.Property("Price") 169 | .HasColumnType("decimal(18,2)"); 170 | 171 | b.Property("Status") 172 | .HasColumnType("nvarchar(max)"); 173 | 174 | b.Property("Type") 175 | .HasColumnType("nvarchar(max)"); 176 | 177 | b.Property("UpdatedAt") 178 | .HasColumnType("datetime2"); 179 | 180 | b.HasKey("Id"); 181 | 182 | b.HasIndex("HotelId"); 183 | 184 | b.ToTable("Rooms"); 185 | }); 186 | 187 | modelBuilder.Entity("HotelBooking.Domain.Entities.RoomsAmenity", b => 188 | { 189 | b.Property("Id") 190 | .ValueGeneratedOnAdd() 191 | .HasColumnType("bigint"); 192 | 193 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 194 | 195 | b.Property("AmenityId") 196 | .HasColumnType("bigint"); 197 | 198 | b.Property("CreatedAt") 199 | .HasColumnType("datetime2"); 200 | 201 | b.Property("IsActive") 202 | .HasColumnType("bit"); 203 | 204 | b.Property("RoomId") 205 | .HasColumnType("bigint"); 206 | 207 | b.Property("UpdatedAt") 208 | .HasColumnType("datetime2"); 209 | 210 | b.HasKey("Id"); 211 | 212 | b.HasIndex("AmenityId"); 213 | 214 | b.HasIndex("RoomId"); 215 | 216 | b.ToTable("RoomsAmenities"); 217 | }); 218 | 219 | modelBuilder.Entity("HotelBooking.Domain.Entities.User", b => 220 | { 221 | b.Property("Id") 222 | .ValueGeneratedOnAdd() 223 | .HasColumnType("bigint"); 224 | 225 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 226 | 227 | b.Property("CardMoney") 228 | .HasColumnType("decimal(18,2)"); 229 | 230 | b.Property("CardNumber") 231 | .HasColumnType("nvarchar(max)"); 232 | 233 | b.Property("CreatedAt") 234 | .HasColumnType("datetime2"); 235 | 236 | b.Property("IsActive") 237 | .HasColumnType("bit"); 238 | 239 | b.Property("Password") 240 | .HasColumnType("nvarchar(max)"); 241 | 242 | b.Property("Role") 243 | .HasColumnType("nvarchar(max)"); 244 | 245 | b.Property("UpdatedAt") 246 | .HasColumnType("datetime2"); 247 | 248 | b.Property("UserName") 249 | .HasColumnType("nvarchar(max)"); 250 | 251 | b.HasKey("Id"); 252 | 253 | b.ToTable("Users"); 254 | }); 255 | 256 | modelBuilder.Entity("HotelBooking.Domain.Entities.Reservation", b => 257 | { 258 | b.HasOne("HotelBooking.Domain.Entities.Room", "Room") 259 | .WithMany() 260 | .HasForeignKey("RoomId"); 261 | 262 | b.HasOne("HotelBooking.Domain.Entities.User", "User") 263 | .WithMany() 264 | .HasForeignKey("UserId"); 265 | 266 | b.Navigation("Room"); 267 | 268 | b.Navigation("User"); 269 | }); 270 | 271 | modelBuilder.Entity("HotelBooking.Domain.Entities.Room", b => 272 | { 273 | b.HasOne("HotelBooking.Domain.Entities.Hotel", "Hotel") 274 | .WithMany() 275 | .HasForeignKey("HotelId"); 276 | 277 | b.Navigation("Hotel"); 278 | }); 279 | 280 | modelBuilder.Entity("HotelBooking.Domain.Entities.RoomsAmenity", b => 281 | { 282 | b.HasOne("HotelBooking.Domain.Entities.Amenity", "Amenity") 283 | .WithMany() 284 | .HasForeignKey("AmenityId"); 285 | 286 | b.HasOne("HotelBooking.Domain.Entities.Room", "Room") 287 | .WithMany() 288 | .HasForeignKey("RoomId"); 289 | 290 | b.Navigation("Amenity"); 291 | 292 | b.Navigation("Room"); 293 | }); 294 | #pragma warning restore 612, 618 295 | } 296 | } 297 | } 298 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Migrations/AppDbContextModelSnapshot.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using HotelBooking.DAL.Configurations; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | 9 | #nullable disable 10 | 11 | namespace HotelBooking.DAL.Migrations 12 | { 13 | [DbContext(typeof(AppDbContext))] 14 | partial class AppDbContextModelSnapshot : ModelSnapshot 15 | { 16 | protected override void BuildModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("ProductVersion", "6.0.12") 21 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 22 | 23 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); 24 | 25 | modelBuilder.Entity("HotelBooking.Domain.Entities.Amenity", b => 26 | { 27 | b.Property("Id") 28 | .ValueGeneratedOnAdd() 29 | .HasColumnType("bigint"); 30 | 31 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 32 | 33 | b.Property("CreatedAt") 34 | .HasColumnType("datetime2"); 35 | 36 | b.Property("IsActive") 37 | .HasColumnType("bit"); 38 | 39 | b.Property("Name") 40 | .HasColumnType("nvarchar(max)"); 41 | 42 | b.Property("UpdatedAt") 43 | .HasColumnType("datetime2"); 44 | 45 | b.HasKey("Id"); 46 | 47 | b.ToTable("Amenities"); 48 | }); 49 | 50 | modelBuilder.Entity("HotelBooking.Domain.Entities.Hotel", b => 51 | { 52 | b.Property("Id") 53 | .ValueGeneratedOnAdd() 54 | .HasColumnType("bigint"); 55 | 56 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 57 | 58 | b.Property("City") 59 | .HasColumnType("nvarchar(max)"); 60 | 61 | b.Property("Country") 62 | .HasColumnType("nvarchar(max)"); 63 | 64 | b.Property("CreatedAt") 65 | .HasColumnType("datetime2"); 66 | 67 | b.Property("IsActive") 68 | .HasColumnType("bit"); 69 | 70 | b.Property("Name") 71 | .HasColumnType("nvarchar(max)"); 72 | 73 | b.Property("Phone") 74 | .HasColumnType("nvarchar(max)"); 75 | 76 | b.Property("Street") 77 | .HasColumnType("nvarchar(max)"); 78 | 79 | b.Property("UpdatedAt") 80 | .HasColumnType("datetime2"); 81 | 82 | b.HasKey("Id"); 83 | 84 | b.ToTable("Hotels"); 85 | }); 86 | 87 | modelBuilder.Entity("HotelBooking.Domain.Entities.Reservation", b => 88 | { 89 | b.Property("Id") 90 | .ValueGeneratedOnAdd() 91 | .HasColumnType("bigint"); 92 | 93 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 94 | 95 | b.Property("ChackIn") 96 | .HasColumnType("datetime2"); 97 | 98 | b.Property("ChackOut") 99 | .HasColumnType("datetime2"); 100 | 101 | b.Property("CreatedAt") 102 | .HasColumnType("datetime2"); 103 | 104 | b.Property("FirstName") 105 | .HasColumnType("nvarchar(max)"); 106 | 107 | b.Property("IsActive") 108 | .HasColumnType("bit"); 109 | 110 | b.Property("LastName") 111 | .HasColumnType("nvarchar(max)"); 112 | 113 | b.Property("Note") 114 | .HasColumnType("nvarchar(max)"); 115 | 116 | b.Property("Payment") 117 | .HasColumnType("decimal(18,2)"); 118 | 119 | b.Property("PaymentType") 120 | .HasColumnType("nvarchar(max)"); 121 | 122 | b.Property("RoomId") 123 | .HasColumnType("bigint"); 124 | 125 | b.Property("Status") 126 | .HasColumnType("nvarchar(max)"); 127 | 128 | b.Property("UpdatedAt") 129 | .HasColumnType("datetime2"); 130 | 131 | b.Property("UserId") 132 | .HasColumnType("bigint"); 133 | 134 | b.HasKey("Id"); 135 | 136 | b.HasIndex("RoomId"); 137 | 138 | b.HasIndex("UserId"); 139 | 140 | b.ToTable("Reservations"); 141 | }); 142 | 143 | modelBuilder.Entity("HotelBooking.Domain.Entities.Room", b => 144 | { 145 | b.Property("Id") 146 | .ValueGeneratedOnAdd() 147 | .HasColumnType("bigint"); 148 | 149 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 150 | 151 | b.Property("Capacity") 152 | .HasColumnType("int"); 153 | 154 | b.Property("CreatedAt") 155 | .HasColumnType("datetime2"); 156 | 157 | b.Property("Desription") 158 | .HasColumnType("nvarchar(max)"); 159 | 160 | b.Property("HotelId") 161 | .HasColumnType("bigint"); 162 | 163 | b.Property("IsActive") 164 | .HasColumnType("bit"); 165 | 166 | b.Property("Price") 167 | .HasColumnType("decimal(18,2)"); 168 | 169 | b.Property("Status") 170 | .HasColumnType("nvarchar(max)"); 171 | 172 | b.Property("Type") 173 | .HasColumnType("nvarchar(max)"); 174 | 175 | b.Property("UpdatedAt") 176 | .HasColumnType("datetime2"); 177 | 178 | b.HasKey("Id"); 179 | 180 | b.HasIndex("HotelId"); 181 | 182 | b.ToTable("Rooms"); 183 | }); 184 | 185 | modelBuilder.Entity("HotelBooking.Domain.Entities.RoomsAmenity", b => 186 | { 187 | b.Property("Id") 188 | .ValueGeneratedOnAdd() 189 | .HasColumnType("bigint"); 190 | 191 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 192 | 193 | b.Property("AmenityId") 194 | .HasColumnType("bigint"); 195 | 196 | b.Property("CreatedAt") 197 | .HasColumnType("datetime2"); 198 | 199 | b.Property("IsActive") 200 | .HasColumnType("bit"); 201 | 202 | b.Property("RoomId") 203 | .HasColumnType("bigint"); 204 | 205 | b.Property("UpdatedAt") 206 | .HasColumnType("datetime2"); 207 | 208 | b.HasKey("Id"); 209 | 210 | b.HasIndex("AmenityId"); 211 | 212 | b.HasIndex("RoomId"); 213 | 214 | b.ToTable("RoomsAmenities"); 215 | }); 216 | 217 | modelBuilder.Entity("HotelBooking.Domain.Entities.User", b => 218 | { 219 | b.Property("Id") 220 | .ValueGeneratedOnAdd() 221 | .HasColumnType("bigint"); 222 | 223 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 224 | 225 | b.Property("CardMoney") 226 | .HasColumnType("decimal(18,2)"); 227 | 228 | b.Property("CardNumber") 229 | .HasColumnType("nvarchar(max)"); 230 | 231 | b.Property("CreatedAt") 232 | .HasColumnType("datetime2"); 233 | 234 | b.Property("FirstName") 235 | .HasColumnType("int"); 236 | 237 | b.Property("IsActive") 238 | .HasColumnType("bit"); 239 | 240 | b.Property("LastName") 241 | .HasColumnType("int"); 242 | 243 | b.Property("Password") 244 | .HasColumnType("nvarchar(max)"); 245 | 246 | b.Property("Phone") 247 | .HasColumnType("nvarchar(max)"); 248 | 249 | b.Property("Role") 250 | .HasColumnType("nvarchar(max)"); 251 | 252 | b.Property("UpdatedAt") 253 | .HasColumnType("datetime2"); 254 | 255 | b.Property("Username") 256 | .HasColumnType("nvarchar(max)"); 257 | 258 | b.HasKey("Id"); 259 | 260 | b.ToTable("Users"); 261 | }); 262 | 263 | modelBuilder.Entity("HotelBooking.Domain.Entities.Reservation", b => 264 | { 265 | b.HasOne("HotelBooking.Domain.Entities.Room", "Room") 266 | .WithMany() 267 | .HasForeignKey("RoomId"); 268 | 269 | b.HasOne("HotelBooking.Domain.Entities.User", "User") 270 | .WithMany() 271 | .HasForeignKey("UserId"); 272 | 273 | b.Navigation("Room"); 274 | 275 | b.Navigation("User"); 276 | }); 277 | 278 | modelBuilder.Entity("HotelBooking.Domain.Entities.Room", b => 279 | { 280 | b.HasOne("HotelBooking.Domain.Entities.Hotel", "Hotel") 281 | .WithMany() 282 | .HasForeignKey("HotelId"); 283 | 284 | b.Navigation("Hotel"); 285 | }); 286 | 287 | modelBuilder.Entity("HotelBooking.Domain.Entities.RoomsAmenity", b => 288 | { 289 | b.HasOne("HotelBooking.Domain.Entities.Amenity", "Amenity") 290 | .WithMany() 291 | .HasForeignKey("AmenityId"); 292 | 293 | b.HasOne("HotelBooking.Domain.Entities.Room", "Room") 294 | .WithMany() 295 | .HasForeignKey("RoomId"); 296 | 297 | b.Navigation("Amenity"); 298 | 299 | b.Navigation("Room"); 300 | }); 301 | #pragma warning restore 612, 618 302 | } 303 | } 304 | } 305 | -------------------------------------------------------------------------------- /HotelBooking.DAL/Migrations/20230322130939_Hotel.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using HotelBooking.DAL.Configurations; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | #nullable disable 11 | 12 | namespace HotelBooking.DAL.Migrations 13 | { 14 | [DbContext(typeof(AppDbContext))] 15 | [Migration("20230322130939_Hotel")] 16 | partial class Hotel 17 | { 18 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 19 | { 20 | #pragma warning disable 612, 618 21 | modelBuilder 22 | .HasAnnotation("ProductVersion", "6.0.12") 23 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 24 | 25 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); 26 | 27 | modelBuilder.Entity("HotelBooking.Domain.Entities.Amenity", b => 28 | { 29 | b.Property("Id") 30 | .ValueGeneratedOnAdd() 31 | .HasColumnType("bigint"); 32 | 33 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 34 | 35 | b.Property("CreatedAt") 36 | .HasColumnType("datetime2"); 37 | 38 | b.Property("IsActive") 39 | .HasColumnType("bit"); 40 | 41 | b.Property("Name") 42 | .HasColumnType("nvarchar(max)"); 43 | 44 | b.Property("UpdatedAt") 45 | .HasColumnType("datetime2"); 46 | 47 | b.HasKey("Id"); 48 | 49 | b.ToTable("Amenities"); 50 | }); 51 | 52 | modelBuilder.Entity("HotelBooking.Domain.Entities.Hotel", b => 53 | { 54 | b.Property("Id") 55 | .ValueGeneratedOnAdd() 56 | .HasColumnType("bigint"); 57 | 58 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 59 | 60 | b.Property("City") 61 | .HasColumnType("nvarchar(max)"); 62 | 63 | b.Property("Country") 64 | .HasColumnType("nvarchar(max)"); 65 | 66 | b.Property("CreatedAt") 67 | .HasColumnType("datetime2"); 68 | 69 | b.Property("IsActive") 70 | .HasColumnType("bit"); 71 | 72 | b.Property("Name") 73 | .HasColumnType("nvarchar(max)"); 74 | 75 | b.Property("Phone") 76 | .HasColumnType("nvarchar(max)"); 77 | 78 | b.Property("Street") 79 | .HasColumnType("nvarchar(max)"); 80 | 81 | b.Property("UpdatedAt") 82 | .HasColumnType("datetime2"); 83 | 84 | b.HasKey("Id"); 85 | 86 | b.ToTable("Hotels"); 87 | }); 88 | 89 | modelBuilder.Entity("HotelBooking.Domain.Entities.Reservation", b => 90 | { 91 | b.Property("Id") 92 | .ValueGeneratedOnAdd() 93 | .HasColumnType("bigint"); 94 | 95 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 96 | 97 | b.Property("ChackIn") 98 | .HasColumnType("datetime2"); 99 | 100 | b.Property("ChackOut") 101 | .HasColumnType("datetime2"); 102 | 103 | b.Property("CreatedAt") 104 | .HasColumnType("datetime2"); 105 | 106 | b.Property("FirstName") 107 | .HasColumnType("nvarchar(max)"); 108 | 109 | b.Property("IsActive") 110 | .HasColumnType("bit"); 111 | 112 | b.Property("LastName") 113 | .HasColumnType("nvarchar(max)"); 114 | 115 | b.Property("Note") 116 | .HasColumnType("nvarchar(max)"); 117 | 118 | b.Property("Payment") 119 | .HasColumnType("decimal(18,2)"); 120 | 121 | b.Property("PaymentType") 122 | .HasColumnType("nvarchar(max)"); 123 | 124 | b.Property("RoomId") 125 | .HasColumnType("bigint"); 126 | 127 | b.Property("Status") 128 | .HasColumnType("nvarchar(max)"); 129 | 130 | b.Property("UpdatedAt") 131 | .HasColumnType("datetime2"); 132 | 133 | b.Property("UserId") 134 | .HasColumnType("bigint"); 135 | 136 | b.HasKey("Id"); 137 | 138 | b.HasIndex("RoomId"); 139 | 140 | b.HasIndex("UserId"); 141 | 142 | b.ToTable("Reservations"); 143 | }); 144 | 145 | modelBuilder.Entity("HotelBooking.Domain.Entities.Room", b => 146 | { 147 | b.Property("Id") 148 | .ValueGeneratedOnAdd() 149 | .HasColumnType("bigint"); 150 | 151 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 152 | 153 | b.Property("Capacity") 154 | .HasColumnType("int"); 155 | 156 | b.Property("CreatedAt") 157 | .HasColumnType("datetime2"); 158 | 159 | b.Property("Desription") 160 | .HasColumnType("nvarchar(max)"); 161 | 162 | b.Property("HotelId") 163 | .HasColumnType("bigint"); 164 | 165 | b.Property("IsActive") 166 | .HasColumnType("bit"); 167 | 168 | b.Property("Price") 169 | .HasColumnType("decimal(18,2)"); 170 | 171 | b.Property("Status") 172 | .HasColumnType("nvarchar(max)"); 173 | 174 | b.Property("Type") 175 | .HasColumnType("nvarchar(max)"); 176 | 177 | b.Property("UpdatedAt") 178 | .HasColumnType("datetime2"); 179 | 180 | b.HasKey("Id"); 181 | 182 | b.HasIndex("HotelId"); 183 | 184 | b.ToTable("Rooms"); 185 | }); 186 | 187 | modelBuilder.Entity("HotelBooking.Domain.Entities.RoomsAmenity", b => 188 | { 189 | b.Property("Id") 190 | .ValueGeneratedOnAdd() 191 | .HasColumnType("bigint"); 192 | 193 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 194 | 195 | b.Property("AmenityId") 196 | .HasColumnType("bigint"); 197 | 198 | b.Property("CreatedAt") 199 | .HasColumnType("datetime2"); 200 | 201 | b.Property("IsActive") 202 | .HasColumnType("bit"); 203 | 204 | b.Property("RoomId") 205 | .HasColumnType("bigint"); 206 | 207 | b.Property("UpdatedAt") 208 | .HasColumnType("datetime2"); 209 | 210 | b.HasKey("Id"); 211 | 212 | b.HasIndex("AmenityId"); 213 | 214 | b.HasIndex("RoomId"); 215 | 216 | b.ToTable("RoomsAmenities"); 217 | }); 218 | 219 | modelBuilder.Entity("HotelBooking.Domain.Entities.User", b => 220 | { 221 | b.Property("Id") 222 | .ValueGeneratedOnAdd() 223 | .HasColumnType("bigint"); 224 | 225 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1); 226 | 227 | b.Property("CardMoney") 228 | .HasColumnType("decimal(18,2)"); 229 | 230 | b.Property("CardNumber") 231 | .HasColumnType("nvarchar(max)"); 232 | 233 | b.Property("CreatedAt") 234 | .HasColumnType("datetime2"); 235 | 236 | b.Property("FirstName") 237 | .HasColumnType("int"); 238 | 239 | b.Property("IsActive") 240 | .HasColumnType("bit"); 241 | 242 | b.Property("LastName") 243 | .HasColumnType("int"); 244 | 245 | b.Property("Password") 246 | .HasColumnType("nvarchar(max)"); 247 | 248 | b.Property("Phone") 249 | .HasColumnType("nvarchar(max)"); 250 | 251 | b.Property("Role") 252 | .HasColumnType("nvarchar(max)"); 253 | 254 | b.Property("UpdatedAt") 255 | .HasColumnType("datetime2"); 256 | 257 | b.Property("Username") 258 | .HasColumnType("nvarchar(max)"); 259 | 260 | b.HasKey("Id"); 261 | 262 | b.ToTable("Users"); 263 | }); 264 | 265 | modelBuilder.Entity("HotelBooking.Domain.Entities.Reservation", b => 266 | { 267 | b.HasOne("HotelBooking.Domain.Entities.Room", "Room") 268 | .WithMany() 269 | .HasForeignKey("RoomId"); 270 | 271 | b.HasOne("HotelBooking.Domain.Entities.User", "User") 272 | .WithMany() 273 | .HasForeignKey("UserId"); 274 | 275 | b.Navigation("Room"); 276 | 277 | b.Navigation("User"); 278 | }); 279 | 280 | modelBuilder.Entity("HotelBooking.Domain.Entities.Room", b => 281 | { 282 | b.HasOne("HotelBooking.Domain.Entities.Hotel", "Hotel") 283 | .WithMany() 284 | .HasForeignKey("HotelId"); 285 | 286 | b.Navigation("Hotel"); 287 | }); 288 | 289 | modelBuilder.Entity("HotelBooking.Domain.Entities.RoomsAmenity", b => 290 | { 291 | b.HasOne("HotelBooking.Domain.Entities.Amenity", "Amenity") 292 | .WithMany() 293 | .HasForeignKey("AmenityId"); 294 | 295 | b.HasOne("HotelBooking.Domain.Entities.Room", "Room") 296 | .WithMany() 297 | .HasForeignKey("RoomId"); 298 | 299 | b.Navigation("Amenity"); 300 | 301 | b.Navigation("Room"); 302 | }); 303 | #pragma warning restore 612, 618 304 | } 305 | } 306 | } 307 | --------------------------------------------------------------------------------