ПИбд-23 Валиуллин Р.А. 1 лабораторная #1 #1
27
ProjectHotel/ProjectHotel/Entities/Athlete.cs
Normal file
27
ProjectHotel/ProjectHotel/Entities/Athlete.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using ProjectHotel.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectHotel.Entities;
|
||||
|
||||
public class Athlete
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FirstName { get; private set; } = string.Empty;
|
||||
public string LastName { get; private set; } = string.Empty;
|
||||
public KindOfSport KindOfSport { get; private set; }
|
||||
public static Athlete CreateEntity(int id, string first, string last, KindOfSport kindOfSport)
|
||||
{
|
||||
return new Athlete
|
||||
{
|
||||
Id = id,
|
||||
FirstName = first ?? string.Empty,
|
||||
LastName = last ?? string.Empty,
|
||||
KindOfSport = kindOfSport
|
||||
};
|
||||
}
|
||||
|
||||
}
|
24
ProjectHotel/ProjectHotel/Entities/Enums/KindOfSport.cs
Normal file
24
ProjectHotel/ProjectHotel/Entities/Enums/KindOfSport.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectHotel.Entities.Enums
|
||||
{
|
||||
public enum KindOfSport
|
||||
{
|
||||
None = 0,
|
||||
Archery = 1,
|
||||
Athletics = 2,
|
||||
Badminton = 3,
|
||||
Basketball = 4,
|
||||
Boxing = 5,
|
||||
Cycling = 6,
|
||||
Fencing = 7,
|
||||
Gymnastics = 8,
|
||||
Rowing = 9,
|
||||
Swimming = 10
|
||||
}
|
||||
}
|
||||
|
43
ProjectHotel/ProjectHotel/Entities/Hotel.cs
Normal file
43
ProjectHotel/ProjectHotel/Entities/Hotel.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectHotel.Entities;
|
||||
|
||||
public class Hotel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string HotelName { get; private set; } = string.Empty;
|
||||
public string Adress { get; private set; } = string.Empty;
|
||||
public int TotalRooms { get; private set; }
|
||||
public int SingleRooms { get; private set; }
|
||||
public int DoubleRooms { get; private set; }
|
||||
public int TripleRooms { get; private set; }
|
||||
|
||||
|
||||
public int AvailableSingleRooms { get; private set; }
|
||||
public int AvailableDoubleRooms { get; private set; }
|
||||
public int AvailableTripleRooms { get; private set; }
|
||||
|
||||
|
||||
public static Hotel CreateEntity(int id, string hotelName, string adress, int totalRooms, int singleRooms, int doubleRooms, int tripleRooms,
|
||||
int availableSingleRooms, int availableDoubleRooms, int availableTripleRooms)
|
||||
{
|
||||
return new Hotel
|
||||
{
|
||||
Id = id,
|
||||
HotelName = hotelName,
|
||||
TotalRooms = totalRooms,
|
||||
Adress = adress,
|
||||
SingleRooms = singleRooms,
|
||||
DoubleRooms = doubleRooms,
|
||||
TripleRooms = tripleRooms,
|
||||
AvailableSingleRooms = availableSingleRooms,
|
||||
AvailableDoubleRooms = availableDoubleRooms,
|
||||
AvailableTripleRooms = tripleRooms
|
||||
|
||||
};
|
||||
}
|
||||
}
|
28
ProjectHotel/ProjectHotel/Entities/PlacingAthlete.cs
Normal file
28
ProjectHotel/ProjectHotel/Entities/PlacingAthlete.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectHotel.Entities;
|
||||
|
||||
public class PlacingAthlete
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int AthleteId { get; private set;}
|
||||
public int RoomId { get; private set; }
|
||||
public DateTime PlacingDate { get; private set; }
|
||||
public DateTime UnplacingDate { get; private set; }
|
||||
public static PlacingAthlete CreateOpeartion(int id, int roomId, int athleteId, DateTime unplacing)
|
||||
{
|
||||
return new PlacingAthlete
|
||||
{
|
||||
Id = id,
|
||||
AthleteId = athleteId,
|
||||
RoomId = roomId,
|
||||
PlacingDate = DateTime.Now,
|
||||
UnplacingDate = unplacing,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
28
ProjectHotel/ProjectHotel/Entities/Rooms.cs
Normal file
28
ProjectHotel/ProjectHotel/Entities/Rooms.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace ProjectHotel.Entities;
|
||||
|
||||
public class Rooms
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int HotelId { get; private set; }
|
||||
public char RoomType { get; private set; }
|
||||
public bool IsAvaiable { get; private set; }
|
||||
public static Rooms CreateEntity(int id, int hotel, char type, bool avalible)
|
||||
{
|
||||
return new Rooms
|
||||
{
|
||||
Id = id,
|
||||
HotelId = hotel,
|
||||
RoomType = type,
|
||||
IsAvaiable = avalible
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
17
ProjectHotel/ProjectHotel/Repositories/IAthleteRepository.cs
Normal file
17
ProjectHotel/ProjectHotel/Repositories/IAthleteRepository.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using ProjectHotel.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectHotel.Repositories;
|
||||
|
||||
public interface IAthleteRepository
|
||||
{
|
||||
IEnumerable<Athlete> ReadAthletes();
|
||||
Athlete ReadAthleteById(int id);
|
||||
void CreateAthlete(Athlete athlete);
|
||||
void UpdateAthlete(Athlete athlete);
|
||||
void DeleteAthlete(int id);
|
||||
}
|
17
ProjectHotel/ProjectHotel/Repositories/IHotelRepository.cs
Normal file
17
ProjectHotel/ProjectHotel/Repositories/IHotelRepository.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using ProjectHotel.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectHotel.Repositories;
|
||||
|
||||
public interface IHotelRepository
|
||||
{
|
||||
IEnumerable<Hotel> ReadAthletes();
|
||||
Athlete ReadHotelById(int id);
|
||||
void CreateHotel(Hotel hotel);
|
||||
void UpdateHotel(Hotel hotel);
|
||||
void DeleteHotel(int id);
|
||||
}
|
18
ProjectHotel/ProjectHotel/Repositories/IPlacingRepository.cs
Normal file
18
ProjectHotel/ProjectHotel/Repositories/IPlacingRepository.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using ProjectHotel.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectHotel.Repositories;
|
||||
|
||||
public interface IPlacingRepository
|
||||
{
|
||||
IEnumerable<PlacingAthlete> ReadPlacing();
|
||||
PlacingAthlete ReadPlacingById(int id);
|
||||
void CreateHotel(PlacingAthlete placing);
|
||||
void UpdateHotel(PlacingAthlete placing);
|
||||
void DeletePlacing(int id);
|
||||
}
|
||||
}
|
12
ProjectHotel/ProjectHotel/Repositories/IRoomRepository.cs
Normal file
12
ProjectHotel/ProjectHotel/Repositories/IRoomRepository.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectHotel.Repositories
|
||||
{
|
||||
internal interface IRoomRepository
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user