Ejemplo n.º 1
0
        public void UpdateCost()
        {
            var selectedRoomType = _roomTypeRepository.GetById(Room.RoomTypeId);

            Room.Cost     = Room.Capacity * selectedRoomType.BaseCost;
            Room.RoomType = selectedRoomType;
            OnPropertyChanged("Room");
        }
Ejemplo n.º 2
0
        public void GetByIdTest()
        {
            var roomType = _repository.GetAll().FirstOrDefault();

            Assert.NotNull(roomType);

            var nRoomType = _repository.GetById(roomType.Id);

            Assert.NotNull(nRoomType);
            Assert.Equal(roomType.Id, nRoomType.Id);
        }
Ejemplo n.º 3
0
 public LocalRoomRepository(IRoomTypeRepository roomTypeRepository)
 {
     _rooms = new List <Room>
     {
         new Room()
         {
             Id         = Guid.NewGuid(),
             Number     = 1,
             RoomTypeId = RoomTypes.Standard,
             Capacity   = 2,
             Cost       = roomTypeRepository.GetById(RoomTypes.Standard).BaseCost * 2
         },
         new Room()
         {
             Id         = Guid.NewGuid(),
             Number     = 2,
             RoomTypeId = RoomTypes.Standard,
             Capacity   = 3,
             Cost       = roomTypeRepository.GetById(RoomTypes.Standard).BaseCost * 3
         },
         new Room()
         {
             Id         = Guid.NewGuid(),
             Number     = 3,
             RoomTypeId = RoomTypes.SemiLuxe,
             Capacity   = 2,
             Cost       = roomTypeRepository.GetById(RoomTypes.SemiLuxe).BaseCost * 2
         },
         new Room()
         {
             Id         = Guid.NewGuid(),
             Number     = 4,
             RoomTypeId = RoomTypes.Luxe,
             Capacity   = 2,
             Cost       = roomTypeRepository.GetById(RoomTypes.Luxe).BaseCost * 2
         }
     };
 }
Ejemplo n.º 4
0
        public ActionResult Edit()
        {
            if (ItemId > 0)
            {
                var roomType = _roomTypeRepository.GetById(ItemId);
                SetPageTitle("Chỉnh sửa loại phòng");

                return(View(roomType));
            }

            SetPageTitle("Tạo mới loại phòng");

            return(View(new RoomType()));
        }
Ejemplo n.º 5
0
 public async Task <RoomType> GetById(int id)
 {
     return(await roomTypeRepository.GetById(id));
 }
Ejemplo n.º 6
0
        public ActionResult Detail(int roomId)
        {
            var model = _roomTypeRepository.GetById(roomId);

            return(View(model));
        }