Пример #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);