public IHttpActionResult PostView_Users_Role(View_Users_Role view_Users_Role) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.View_Users_Role.Add(view_Users_Role); try { db.SaveChanges(); } catch (DbUpdateException) { if (View_Users_RoleExists(view_Users_Role.Id)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = view_Users_Role.Id }, view_Users_Role); }
public IHttpActionResult PutView_Users_Role(int id, View_Users_Role view_Users_Role) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != view_Users_Role.Id) { return BadRequest(); } db.Entry(view_Users_Role).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!View_Users_RoleExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }