public async Task <ActionResult> UpdateAsync(CallOffId callOffId, OrderingPartyModel model) { if (model is null) { throw new ArgumentNullException(nameof(model)); } var order = await orderingPartyService.GetOrder(callOffId); if (order is null) { return(NotFound()); } var orderingParty = new OrderingParty { Name = model.Name, OdsCode = model.OdsCode, Address = contactDetailsService.AddOrUpdateAddress(order.OrderingParty.Address, model.Address), }; Contact contact = contactDetailsService.AddOrUpdatePrimaryContact( order.OrderingPartyContact, model.PrimaryContact); await orderingPartyService.SetOrderingParty(order, orderingParty, contact); return(NoContent()); }
public async Task <IActionResult> UpdateAsync(CallOffId callOffId, SupplierModel model) { if (model is null) { throw new ArgumentNullException(nameof(model)); } var order = await supplierSectionService.GetOrder(callOffId); if (order is null) { return(NotFound()); } var supplierModel = new Supplier { Id = model.SupplierId, Name = model.Name, Address = contactDetailsService.AddOrUpdateAddress(order.Supplier?.Address, model.Address), }; var contact = contactDetailsService.AddOrUpdatePrimaryContact( order.SupplierContact, model.PrimaryContact); await supplierSectionService.SetSupplierSection(order, supplierModel, contact); return(NoContent()); }