public async Task <VaccineDeliveryReport> AddDeliveryReport(VaccineDeliveryReport report) { _reportContext.Delivery.Add(report); await _reportContext.SaveChangesAsync(); return(report); }
public async Task <ActionResult <VaccineDeliveryReport> > AddDeliveryReport([FromBody] VaccineDeliveryReport report) { if (!ModelState.IsValid) { Console.WriteLine("Invalid state..."); return(BadRequest(ModelState)); } var newReport = await _IInleveransRepository.AddDeliveryReport(report); return(CreatedAtAction(nameof(GetAllDeliveryReport), new { id = newReport.Id }, newReport)); }
public async Task UpdateDeliveryReport(VaccineDeliveryReport report) { _reportContext.Entry(report).State = EntityState.Modified; await _reportContext.SaveChangesAsync(); }