예제 #1
0
        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));
            }
        }
예제 #2
0
 partial void OnAddressUpdated(Models.Crm.Address item);
예제 #3
0
 partial void OnAddressDeleted(Models.Crm.Address item);