public IHttpActionResult PutPTMCalls(int id, PTMCalls pTMCalls) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pTMCalls.ID) { return(BadRequest()); } db.Entry(pTMCalls).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PTMCallsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { PTMCalls pTMCalls = db.ptmCall.Find(id); db.ptmCall.Remove(pTMCalls); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,date,Titile,Message,Creater")] PTMCalls pTMCalls) { if (ModelState.IsValid) { db.Entry(pTMCalls).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pTMCalls)); }
public IHttpActionResult GetPTMCalls(int id) { PTMCalls pTMCalls = db.ptmCall.Find(id); if (pTMCalls == null) { return(NotFound()); } return(Ok(pTMCalls)); }
public ActionResult CreatebyAdmin([Bind(Include = "ID,date,Titile,Message,Creater")] PTMCalls pTMCalls) { if (ModelState.IsValid) { ViewBag.msg = "Message sent successfully"; db.ptmCall.Add(pTMCalls); db.SaveChanges(); return(View()); } return(View(pTMCalls)); }
public IHttpActionResult PostPTMCalls(PTMCalls pTMCalls) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ptmCall.Add(pTMCalls); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = pTMCalls.ID }, pTMCalls)); }
// GET: PTMCalls/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PTMCalls pTMCalls = db.ptmCall.Find(id); if (pTMCalls == null) { return(HttpNotFound()); } return(View(pTMCalls)); }
public IHttpActionResult DeletePTMCalls(int id) { PTMCalls pTMCalls = db.ptmCall.Find(id); if (pTMCalls == null) { return(NotFound()); } db.ptmCall.Remove(pTMCalls); db.SaveChanges(); return(Ok(pTMCalls)); }