public async Task <VaccineSupplier> AddSupplier(VaccineSupplier report) { _reportContext.Vaccinesuppliers.Add(report); await _reportContext.SaveChangesAsync(); return(report); }
public async Task <ActionResult <VaccineSupplier> > AddSupplier([FromBody] VaccineSupplier report) { if (report == null) { throw new ArgumentNullException(nameof(report)); } if (!ModelState.IsValid) { Console.WriteLine("Invalid state..."); BadRequest(ModelState); } var newReport = await _IVaccinLeverantörerRepository.AddSupplier(report); return(CreatedAtAction(nameof(GetAllVaccinationSupplier), new { id = newReport.Id }, newReport)); }