public async Task <IActionResult> EditRoom(int roomId, int hotelId) { var room = await _hotelService.GetRoom(roomId, hotelId); var isAuthorized = User.IsInRole(Constants.AdministratorsRole); if (!isAuthorized) { var userId = _identityService.Get(User).Id; if (room.OwnerId != userId) { return(Forbid()); } } var categories = await _categoryService.GetRoomCategories(); var roomVM = new RoomViewModel { ImageUrlDisPlay = room.ImageUrl, RoomCategories = categories.ToList(), Room = ChangeUriPlaceholderRoom(room) }; return(View(roomVM)); }
public async Task <IActionResult> Index(string searchString) { var roomcategories = await _service.GetRoomCategories(); var roomcategoryVM = new RoomCategoryViewModel { RoomCategories = roomcategories.ToList() }; return(View(roomcategoryVM)); }