示例#1
0
        public IActionResult PutPersistedGrant(string key, [FromBody] Models.ConData.PersistedGrant newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnPersistedGrantUpdated(newItem);
                this.context.PersistedGrants.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.PersistedGrants.Where(i => i.Key == key);
                this.OnAfterPersistedGrantUpdated(newItem);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
示例#2
0
        public IActionResult Post([FromBody] Models.ConData.PersistedGrant item)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (item == null)
                {
                    return(BadRequest());
                }

                this.OnPersistedGrantCreated(item);
                this.context.PersistedGrants.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/ConData/PersistedGrants/{item.Key}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
示例#3
0
 partial void OnAfterPersistedGrantUpdated(Models.ConData.PersistedGrant item);
示例#4
0
 partial void OnPersistedGrantDeleted(Models.ConData.PersistedGrant item);