コード例 #1
0
ファイル: RoomTypeServiceTest.cs プロジェクト: buibup/hotels
        public async Task GetRoomTypeAsyncTest()
        {
            var roomType = _roomTypeService.GetAllRoomTypes().FirstOrDefault();

            Assert.NotNull(roomType);
            var result = await _roomTypeService.GetRoomTypeByIdAsync(roomType.RoomTypeId.Value);

            Assert.NotNull(result);
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            RoomType = await _roomTypeService.GetRoomTypeByIdAsync(id ?? 0);

            if (RoomType == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #3
0
        public async Task <ActionResult> GetRoomTypeByIdAsync(int id)
        {
            var roomType = await _roomTypeService.GetRoomTypeByIdAsync(id);

            return(Ok(roomType));
        }