// GET: Guest/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var guest = await _guestService.GetGuest((int)id); if (guest == null) { return(NotFound()); } return(View(guest)); }
public async Task <IActionResult> Complete(ReservationDetailViewModel currentReservation) { bool isReserved; if (currentReservation.Guest.GuestId > 0) { _guestService.EditGuest(currentReservation.Guest); isReserved = _reservationService.AddReservation(currentReservation); } else { var newGuestId = _guestService.AddGuest(currentReservation.Guest); var newGuest = await _guestService.GetGuest(newGuestId); currentReservation.Guest = newGuest; isReserved = _reservationService.AddReservation(currentReservation); } if (isReserved) { //ViewBag.Message = "Reservation completed succesfully!"; ViewBag.Succes = 1; } else { ViewBag.Message = "Reservation failed!"; ViewBag.Succes = 1; } return(View(nameof(Index), await _reservationService.AllReservations())); }
public async Task <ActionResult <GuestModel> > GetGuest(int id) { var userId = GetAuthorizedUserId(); var guest = await _guestService.GetGuest(id, userId); return(Ok(guest)); }
public async Task <IHttpActionResult> GetGuest(int id) { var guests = await _service.GetGuest(id); return(Ok(guests)); }
public async Task <IActionResult> GetGuest(Guid id) { return(Ok(await _service.GetGuest(id))); }