public async Task <bool> ConfirmGuest(ConfirmGuestDTORequest request) { Request req = await requestRepository.GetOneByIdAsync(request.RequestId); if (req == null) { throw new NotFoundException($"Request not found"); } Reservation reserv = await reservationRepository.FindOneByIdAsync(request.ReservationId); if (reserv == null) { throw new NotFoundException($"Reservation not found"); } Console.WriteLine("Cantidad de user Reservations"); Console.WriteLine(reserv.UserReservations.Count); var ur = reserv.UserReservations.Where(uR => uR.UserId == request.hostId); if (ur == null) { throw new NotFoundException($"Host not found"); } req.ConstantId = RequestStatus.Confirmed; req = await requestRepository.UpdateOneAsync(req); return(true); }
public async Task <IActionResult> ConfirmRequest([FromBody] ConfirmGuestDTORequest RequestDto) { try { var response = await requestService.ConfirmGuest(RequestDto); return(Ok(response)); } catch (Exception e) { return(HttpExceptionMapper.ToHttpActionResult(e)); } }