static void Main(string[] args) { Console.WriteLine("Enter flat style: (light or dark)"); string flatStyle = Console.ReadLine(); Flat flat = new Flat(); //todo IRoomFactory factory = CreateFactory(flatStyle); flat.Room1 = factory.CreateRoom(); flat.Room2 = factory.CreateRoom(); flat.Balcony = factory.CreateBalcony(); }
public RoomView CreateRoom(string currentUserId) { var room = _unitOfWork.GetRepository <Room>().GetAll().FirstOrDefault(x => x.CreatorId == currentUserId); var currentUser = _unitOfWork.GetRepository <AppUser>().FindBy(x => x.Id == currentUserId); if (room == null) { room = _unitOfWork.GetRepository <Room>().AddAndSave(_roomFactory.CreateRoom(currentUserId, new List <AppUser> { currentUser })); } return(_roomFactory.CastToRoomView(room)); }
static void Main() { Console.WriteLine("You are about to make home improvements."); Console.WriteLine("Now you have to choose a color scheme."); Console.WriteLine("Please, type 1 for light style or 2 for dark style."); Console.Write("Enter your choice: "); string choice = Console.ReadLine(); IRoomFactory factory = CreateFactory(choice); var flat = new Flat { Room1 = factory.CreateRoom(), Room2 = factory.CreateRoom() }; Console.WriteLine("Your Room1 wallpaper is {0}.", flat.Room1.Wallpaper.Color); Console.WriteLine("Your Room1 chandelier is {0}.", flat.Room1.Chandelier.Color); Console.WriteLine("Your Room2 wallpaper is {0}.", flat.Room2.Wallpaper.Color); Console.WriteLine("Your Room2 chandelier is {0}.", flat.Room2.Chandelier.Color); Console.Write("Press any key to close the application: "); Console.ReadLine(); }
public void CreateStoryElements() { Random random = new Random(); var monsterID = random.Next(0, monsterFactory.Count - 1); monster = monsterFactory.GetMonster(monsterID); var lootID = random.Next(0, lootFactory.Count - 1); loot = lootFactory.GetLoot(lootID); var roomWidth = random.Next(1, roomFactory.MaxWidth); var roomLength = random.Next(1, roomFactory.MaxLength); room = roomFactory.CreateRoom(roomWidth, roomLength); }