示例#1
0
        public IHttpActionResult Update([FromBody] SuppliersView supplierView)
        {
            var supplier = mapper.Map <SuppliersDTM>(supplierView);

            try
            {
                service.UpdateAsync(supplier);
                return(Ok());
            }
            catch
            {
                return(NotFound());
            }
        }
示例#2
0
        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));
        }
示例#3
0
 public static Task UpdateAsync(this ISuppliersService service, long supplierId, IReadOnlyDictionary <string, object> changes)
 {
     return(service.UpdateAsync(supplierId, new Dictionary <string, object>(changes)));
 }