public IHttpActionResult PutImtFaq(int id, ImtFaq imtFaq) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != imtFaq.Id) { return(BadRequest()); } db.Entry(imtFaq).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ImtFaqExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetImtFaq(int id) { ImtFaq imtFaq = db.ImtFaqs.Find(id); if (imtFaq == null) { return(NotFound()); } return(Ok(imtFaq)); }
public IHttpActionResult PostImtFaq(ImtFaq imtFaq) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ImtFaqs.Add(imtFaq); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = imtFaq.Id }, imtFaq)); }
public IHttpActionResult DeleteImtFaq(int id) { ImtFaq imtFaq = db.ImtFaqs.Find(id); if (imtFaq == null) { return(NotFound()); } db.ImtFaqs.Remove(imtFaq); db.SaveChanges(); return(Ok(imtFaq)); }