public IHttpActionResult PutPlatformRoles(int id, PlatformRole platformRoles) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != platformRoles.id) { return(BadRequest()); } db.Entry(platformRoles).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PlatformRolesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostPlatformRoles(PlatformRole platformRoles) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PlatformRoles.Add(platformRoles); db.SaveChanges(); return(CreatedAtRoute("DefaultApiPost", new { id = platformRoles.id }, platformRoles)); }
public IHttpActionResult DeletePlatformRoles(int id) { PlatformRole platformRoles = db.PlatformRoles.Find(id); if (platformRoles == null) { return(NotFound()); } db.PlatformRoles.Remove(platformRoles); db.SaveChanges(); return(Ok(platformRoles)); }
public IHttpActionResult GetPlatformRoles(int id) { PlatformRole platformRoles = db.PlatformRoles.Find(id); if (platformRoles == null) { return(NotFound()); } return(Ok(new DropDownDTO { id = platformRoles.id.ToString(), description = platformRoles.description })); }