public void GetRoomTypeTest() { var roomType = _roomTypeService.GetAllRoomTypes().FirstOrDefault(); Assert.NotNull(roomType); Assert.NotNull(_roomTypeService.GetRoomTypeById(roomType.RoomTypeId.Value)); }
public async Task <IActionResult> GetRoomType(int id) { var roomType = await _roomTypeService.GetRoomTypeById(id); if (roomType == null) { return(NotFound()); } return(Ok(roomType)); }
/// <summary> /// Retrieves one value from the list of values /// </summary> /// <param name=<em>"id"</em>>The id of the item to be retrieved</param> /// <returns></returns> // GET: api/RoomType/5 public HttpResponseMessage GetRoomType(int id) { try { var Temp = _RoomTypeService.GetRoomTypeById(id); if (Temp != null) { return(Request.CreateResponse(HttpStatusCode.OK, Temp)); } return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Customer found for this id")); } catch (Exception) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }