public async Task <IActionResult> PostSupplier([FromBody] Supplier supplier) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } appDbContext.Suppliers.Add(supplier); await appDbContext.SaveChangesAsync(); return(CreatedAtAction("PostSupplier", new { id = supplier.Id }, supplier)); }
public async Task SaveSupplierAsync(SupplierDTO supplierDTO) { Supplier supplier = Mappers.SupplierMapper.DTOToSupplier(supplierDTO); await dbContext.AddAsync(supplier); await dbContext.SaveChangesAsync(); }