示例#1
0
        public IActionResult PutParameter(int key, [FromBody] Models.Sde.Parameter newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (newItem == null || (newItem.ParameterId != key))
                {
                    return(BadRequest());
                }

                this.OnParameterUpdated(newItem);
                this.context.Parameters.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Parameters.Where(i => i.ParameterId == key);
                Request.QueryString = Request.QueryString.Add("$expand", "Extract");
                this.OnAfterParameterUpdated(newItem);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
示例#2
0
 partial void OnParameterDeleted(Models.Sde.Parameter item);
示例#3
0
 partial void OnAfterParameterUpdated(Models.Sde.Parameter item);
示例#4
0
 partial void OnParameterCreated(Models.Sde.Parameter item);