public async Task <ActionResult <int> > PostClientBooking(ClientBookingDto booking) { if (ModelState.IsValid) { ClientBooking clientBooking = mapper.Map <ClientBooking>(booking); var bookingId = await clientRepository.AddBookingAsync(clientBooking); if (bookingId > 0) { int logId = await emailSender.SendEmailAsync(bookingId); if (logId > 0) { return(Ok(bookingId)); } } else { if (bookingId == -1) { return(NoContent()); } return(NotFound()); } } return(BadRequest()); }
public async Task <IActionResult> PutClientBooking(ClientBookingDto booking) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ClientBooking updatedBooking = mapper.Map <ClientBooking>(booking); bool result = await clientRepository.UpdateBookingAsync(updatedBooking); if (result) { return(NoContent()); } return(NotFound()); }