public IHttpActionResult Putinterests(decimal id, interests interests) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != interests.id) { return(BadRequest()); } db.Entry(interests).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!interestsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getinterests(decimal id) { interests interests = db.interests.Find(id); if (interests == null) { return(NotFound()); } return(Ok(interests)); }
public IHttpActionResult Postinterests(interests interests) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.interests.Add(interests); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = interests.id }, interests)); }
public IHttpActionResult Deleteinterests(decimal id) { interests interests = db.interests.Find(id); if (interests == null) { return(NotFound()); } db.interests.Remove(interests); db.SaveChanges(); return(Ok(interests)); }