public async Task <DtoShipperGet> PutShipper(int id, [FromBody] DtoShipperPut dtoShipper) { var item = await queryProcessor.Update(id, dtoShipper); var model = autoMapper.Map <DtoShipperGet>(item); return(model); }
public async Task <Shipper> Update(int id, DtoShipperPut dtoShipperPut) { var shipper = await unitOfWork.Query <Shipper>().FirstOrDefaultAsync(s => s.ShipperID == id); if (shipper == null) { throw new KeyNotFoundException(); } shipper.CompanyName = dtoShipperPut.CompanyName; shipper.Phone = dtoShipperPut.Phone; unitOfWork.Commit(); BackgroundJob.Enqueue(() => RefreshCache()); return(shipper); }