public JsonResult Edit(tool_box_topic ToolBoxObj) { try { ToolBoxObj.date_of_entry = DateTime.Now; var db = new qhsedbEntities(); if (ModelState.IsValid) { ToolBoxObj.id = ToolBoxObj.id; db.Entry(ToolBoxObj).State = EntityState.Modified; // loanRequest.LoanDate = loanRequest.LoanDate; db.SaveChanges(); } return(Json("Edited ToolBox System", JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(e.Message, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(tool_box_topic tool_box_topic) { if (ModelState.IsValid) { var db = new qhsedbEntities(); db.tool_box_topic.Add(tool_box_topic); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tool_box_topic)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var db = new qhsedbEntities(); tool_box_topic tool_box_topic = db.tool_box_topic.Find(id); if (tool_box_topic == null) { return(HttpNotFound()); } return(View(tool_box_topic)); }
public JsonResult AddToolBox(tool_box_topic ToolBoxObj) { try { ToolBoxObj.date_of_entry = DateTime.Now; var db = new qhsedbEntities(); db.tool_box_topic.Add(ToolBoxObj); db.SaveChanges(); return(Json("Added New ToolBox Entry Successfully", JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(e.Message, JsonRequestBehavior.AllowGet)); } }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var db = new qhsedbEntities(); tool_box_topic tool_box_topic = db.tool_box_topic.Find(id); if (tool_box_topic == null) { return(HttpNotFound()); } var ToolBoxRow = db.tool_box_topic.Find(id); db.tool_box_topic.Remove(ToolBoxRow); db.SaveChanges(); return(RedirectToAction("Index")); }