public ActionResult DeleteConfirmed(Guid id) { DeptTBL deptTBL = db.Dept.Find(id); db.Dept.Remove(deptTBL); db.SaveChanges(); return(RedirectToAction("Index", "Company")); }
// GET: Dept/Create public ActionResult Create(Guid?id) { DeptTBL t = new DeptTBL() { compId = (Guid)id }; return(View(t)); }
public ActionResult Edit([Bind(Include = "id,compId,deptDesc,deptName")] DeptTBL deptTBL) { if (ModelState.IsValid) { db.Entry(deptTBL).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Company")); } return(View(deptTBL)); }
public ActionResult Create([Bind(Include = "id,compId,deptDesc,deptName")] DeptTBL deptTBL) { if (ModelState.IsValid) { deptTBL.id = Guid.NewGuid(); db.Dept.Add(deptTBL); db.SaveChanges(); return(RedirectToAction("Index", "Company")); } return(View(deptTBL)); }
// GET: Dept/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DeptTBL deptTBL = db.Dept.Find(id); if (deptTBL == null) { return(HttpNotFound()); } return(View(deptTBL)); }