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)); } }
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)); } }
partial void OnAfterPersistedGrantUpdated(Models.ConData.PersistedGrant item);
partial void OnPersistedGrantDeleted(Models.ConData.PersistedGrant item);