public async Task <IActionResult> ReadByRoomID(int id) { try { var room = _roomService.GetRoom(id); if (room.Result != null) { return(Ok(await _roomService.GetRoom(id))); } return(NotFound()); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex)); } }
public IActionResult Edit(int id) { //Room roomForEdit = this.context.Rooms.Find(id); Room roomForEdit = roomServices.GetRoom(id); EditRoomViewModel model = new EditRoomViewModel { Id = roomForEdit.Id, Capacity = roomForEdit.Capacity, RoomType = roomForEdit.RoomType, FreeRoom = roomForEdit.FreeRoom, PricePerAdult = roomForEdit.PricePerAdult, PricePerKid = roomForEdit.PricePerKid, RoomNumber = roomForEdit.RoomNumber }; return(View(model)); }