Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Commit

Permalink
Удалил класс AbstractEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
nzour committed Dec 7, 2019
1 parent 1c39ffb commit f9fc9b6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 27 deletions.
14 changes: 0 additions & 14 deletions src/Domain/AbstractEntity.cs

This file was deleted.

7 changes: 4 additions & 3 deletions src/Domain/Entities/ReservationEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

namespace Domain.Entities
{
public class ReservationEntity : AbstractEntity
public class ReservationEntity
{
public Guid Id { get; }
public UserEntity User { get; }
public RoomEntity Room { get; }
public DateTime ReservedFrom { get; }
Expand All @@ -17,8 +18,8 @@ public class ReservationEntity : AbstractEntity
public ReservationEntity(UserEntity user, RoomEntity room, DateTime from, DateTime to, IEnumerable<ServiceEntity> services)
{
ReservationException.AssertDatesValid(from, to);
Identify();

Id = Guid.NewGuid();
User = user;
Room = room;
ReservedFrom = from;
Expand Down
7 changes: 4 additions & 3 deletions src/Domain/Entities/RoomEntity.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;

namespace Domain.Entities
Expand All @@ -9,17 +10,17 @@ public enum RoomType
Triple
}

public class RoomEntity : AbstractEntity
public class RoomEntity
{
public Guid Id { get; }
public RoomType RoomType { get; set; }
public int Cost { get; set; }
public ISet<UserEntity> Employees { get; protected set; } = new HashSet<UserEntity>();
public ISet<TransactionEntity> Transactions { get; protected set; } = new HashSet<TransactionEntity>();

public RoomEntity(RoomType roomType, uint cost)
{
Identify();

Id = Guid.NewGuid();
RoomType = roomType;
Cost = (int) cost;
}
Expand Down
7 changes: 5 additions & 2 deletions src/Domain/Entities/ServiceEntity.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using System;

namespace Domain.Entities
{
public class ServiceEntity : AbstractEntity
public class ServiceEntity
{
public Guid Id { get; }
public string Name { get; set; }
public int Cost { get; set; }

public ServiceEntity(string name, uint cost)
{
Identify();
Id = Guid.NewGuid();
Name = name;
Cost = (int) cost;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Domain/Entities/TransactionEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

namespace Domain.Entities
{
public class TransactionEntity : AbstractEntity
public class TransactionEntity
{
public Guid Id { get; }
public UserEntity User { get; }
public RoomEntity Room { get; }
public IEnumerable<ServiceEntity> Services { get; }
Expand All @@ -14,8 +15,7 @@ public class TransactionEntity : AbstractEntity

public TransactionEntity(UserEntity user, RoomEntity room, IEnumerable<ServiceEntity> services)
{
Identify();

Id = Guid.NewGuid();
User = user;
Room = room;
Services = services;
Expand Down
6 changes: 4 additions & 2 deletions src/Domain/Entities/UserEntity.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;

namespace Domain.Entities
Expand All @@ -9,8 +10,9 @@ public enum UserRole
Client
}

public class UserEntity : AbstractEntity
public class UserEntity
{
public Guid Id { get; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Login { get; protected internal set; }
Expand All @@ -21,7 +23,7 @@ public class UserEntity : AbstractEntity

public UserEntity(string firstName, string lastName, string login, string password, UserRole role)
{
Identify();
Id = Guid.NewGuid();
FirstName = firstName;
LastName = lastName;
Login = login;
Expand Down

0 comments on commit f9fc9b6

Please sign in to comment.