ПИбд-23 Валиуллин Р.А. 1 лабораторная #1 #1

Closed
rinat wants to merge 5 commits from lab1 into main
9 changed files with 214 additions and 0 deletions
Showing only changes of commit 8f986c6beb - Show all commits

View 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
};
}
}

View 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
}
}

View 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
};
}
}

View 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,
};
}
}

View 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
};
}
}

View 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);
}

View 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);
}

View 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);
}
}

View 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
{
}
}