public ActionResult <RoomResponse> Create(RoomRequest item) { var itemRoomType = db.RoomTypes.Find(item.RoomType); if (itemRoomType == null) { return(NotFound(new ProblemDetails() { Title = $"RoomType code : {item.RoomType} not found" })); } Room newRoom = item.ToModel(); db.Add(newRoom); db.SaveChanges(); return(CreatedAtAction(nameof(GetById), new { id = newRoom.Id }, RoomResponse.FromModel(newRoom))); }