예제 #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);