public IHttpActionResult Update([FromBody] SuppliersView supplierView) { var supplier = mapper.Map <SuppliersDTM>(supplierView); try { service.UpdateAsync(supplier); return(Ok()); } catch { return(NotFound()); } }
public async Task <ActionResult> Update(Supplier supplier, CancellationToken ct = default) { var oldSupplier = await _suppliersService.GetAsync(supplier.Id, true, ct); if (oldSupplier == null) { return(NotFound(supplier.Id)); } return(await ActionIfAllowed( () => _suppliersService.UpdateAsync(_userContext.UserId, oldSupplier, supplier, ct), Roles.Suppliers, oldSupplier.AccountId)); }
public static Task UpdateAsync(this ISuppliersService service, long supplierId, IReadOnlyDictionary <string, object> changes) { return(service.UpdateAsync(supplierId, new Dictionary <string, object>(changes))); }