private RoomDbModel CreateRandomRoom() { var result = new RoomDbModel(); var rand = new Random(); int value = rand.Next(Enum.GetNames(typeof(Bedding)).Length); result.Bedding = ((Bedding)value).ToString(); return(result); }
public RoomDbModel CreateRoom(int floor, int roomNumber, HotelInitModel model) { roomNumber = floor * 100 + roomNumber; RoomDbModel room = null; switch (model.Mode) { case CreateMode.Random: room = CreateRandomRoom(); break; default: throw new ArgumentException($"Unknown room creation mode: {model.Mode} "); } room.Number = roomNumber; room.Description = $"Room# ${roomNumber}"; room.MaxOccupants = 4; room.Amenities = model.Amenities; return(room); }