public async Task <ActionResult <Data.Models.Supplier> > PostSupplier(Data.Models.Supplier supplier) { if (supplier == null) { return(BadRequest()); } supplier.Slug = Slug.Generate(supplier.CompanyName); await _supplierService.Create(supplier); return(CreatedAtAction("GetSupplier", new { id = supplier.Id }, supplier)); }
public async Task <IActionResult> PutSupplier(int id, Data.Models.Supplier supplier) { if (id != supplier.Id || supplier == null) { return(BadRequest()); } var _supplierExists = await _supplierService.GetById(id); if (_supplierExists == null) { return(NotFound()); } await _supplierService.Edit(supplier); return(NoContent()); }