public async Task <DomainBooking> CreateAsync(BookingUpdateModel model) { var result = await Context.Bookings.AddAsync(Mapper.Map <EntityBooking>(model)); await Context.SaveChangesAsync(); return(Mapper.Map <DomainBooking>(result.Entity)); }
public async Task <DomainBooking> UpdateAsync(BookingUpdateModel model) { var existing = await Get(model); Context.Entry(existing).State = EntityState.Modified; var result = Mapper.Map(model, existing); Context.Update(result); await Context.SaveChangesAsync(); return(Mapper.Map <DomainBooking>(result)); }
public async Task <IActionResult> PutAsync(BookingUpdateModel data) { try { await bookingService.UpdateBookingAsync(data); return(Ok()); } catch (Exception ex) { throw ex; } }