// POST: odata/RoleRightsViews public async Task <IHttpActionResult> Post(RoleRightsView roleRightsView) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.RoleRightsViews.Add(roleRightsView); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (RoleRightsViewExists(roleRightsView.RightsId)) { return(Conflict()); } else { throw; } } return(Created(roleRightsView)); }
// DELETE: odata/RoleRightsViews(5) public async Task <IHttpActionResult> Delete([FromODataUri] short key) { RoleRightsView roleRightsView = await db.RoleRightsViews.FindAsync(key); if (roleRightsView == null) { return(NotFound()); } db.RoleRightsViews.Remove(roleRightsView); await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/RoleRightsViews(5) public async Task <IHttpActionResult> Put([FromODataUri] short key, Delta <RoleRightsView> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } RoleRightsView roleRightsView = await db.RoleRightsViews.FindAsync(key); if (roleRightsView == null) { return(NotFound()); } patch.Put(roleRightsView); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoleRightsViewExists(key)) { return(NotFound()); } else { throw; } } return(Updated(roleRightsView)); }