public IHttpActionResult PutView_Role(int id, View_Role view_Role) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != view_Role.Id) { return BadRequest(); } db.Entry(view_Role).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!View_RoleExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostView_Role(View_Role view_Role) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.View_Role.Add(view_Role); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = view_Role.Id }, view_Role); }