public async Task <IHttpActionResult> Post2Async(QRCode qrcode) { try { // State is email var qrCodeManager = new QRCodeManagement(); var user = new User() { Correo = qrcode.State }; // Id is reservation ID var qrCodeFound = qrCodeManager.RetrieveByReservationId(qrcode.Id); // Send Email await qrCodeManager.SendEmail(user, qrCodeFound.Value); apiResponse = new ApiResponse(); return(Ok(apiResponse)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.AppMessage.Message))); } }
public async Task <IHttpActionResult> Post3Async(Reservation reservation) { try { var qrCodeManager = new QRCodeManagement(); var userManager = new UserManagement(); var reservationManager = new ReservationManagement(); // State is user email var user = new User() { Correo = reservation.State }; var userFound = userManager.RetrieveByCorreo(user); var subReservationCreated = reservationManager.CreateSubreservation(reservation, userFound); // Build QR Code QRCode code = new QRCode() { Id = userFound.Id, Value = "none", State = "none", FK_SubReservation = subReservationCreated.FkSubreservation }; QRCode qrcode = qrCodeManager.Create(code, "INVITADO_ENA"); // Send Email await qrCodeManager.SendEmail(user, qrcode.Value); apiResponse = new ApiResponse(); return(Ok(apiResponse)); } catch (BussinessException bex) { return(InternalServerError(new Exception(bex.AppMessage.Message))); } }