public void RooomsValidate(Rooms room) { if (room.ID > 0) { var type = _roomstyperepository.Find(x => x.Type == room.Type).Any(); DomainException.When(type, "Room Type is Existe"); Save(room); } else { var getroom = _roomstyperepository.GetById(room.ID); getroom.ID = room.ID; getroom.Type = room.Type; getroom.Quantity = room.Quantity; getroom.RoomPrice = room.RoomPrice; getroom.LockQuant = room.LockQuant; Update(getroom); } }
public void CheckFreerRoom(Booking booking) { var room = _roomrepository.GetById(booking.Room.ID); DomainException.When(room.Quantity - room.LockQuant > 0, "Quantide de quarto indisponivel para reserva !!"); }