public IActionResult PutAddress(Guid key, [FromBody] Models.Crm.Address newItem) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (newItem == null || (newItem.Id != key)) { return(BadRequest()); } this.OnAddressUpdated(newItem); this.context.Addresses.Update(newItem); this.context.SaveChanges(); var itemToReturn = this.context.Addresses.Where(i => i.Id == key); Request.QueryString = Request.QueryString.Add("$expand", "Country"); return(new ObjectResult(SingleResult.Create(itemToReturn))); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(BadRequest(ModelState)); } }
partial void OnAddressUpdated(Models.Crm.Address item);
partial void OnAddressDeleted(Models.Crm.Address item);