public IHttpActionResult Putperfile(int id, perfile perfile) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != perfile.perfilid) { return(BadRequest()); } db.Entry(perfile).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!perfileExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getperfile(int id) { perfile perfile = db.perfiles.Find(id); if (perfile == null) { return(NotFound()); } return(Ok(perfile)); }
public IHttpActionResult Postperfile(perfile perfile) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.perfiles.Add(perfile); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = perfile.perfilid }, perfile)); }
public IHttpActionResult Deleteperfile(int id) { perfile perfile = db.perfiles.Find(id); if (perfile == null) { return(NotFound()); } db.perfiles.Remove(perfile); db.SaveChanges(); return(Ok(perfile)); }