public ActionResult Edit(int id) { if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty)) { return(RedirectToAction("Login", "Login", null)); } ViewBag.Logout = Session["Username"].ToString().ToUpper(); ViewBag.roleid = Session["RoleID"]; String Username = Session["Username"].ToString(); using (i_facility_unimechEntities condb = new i_facility_unimechEntities()) { var tblpm = condb.configuration_tblpmcheckpoint.Where(m => m.pmcpID == id && m.Isdeleted == 0).FirstOrDefault(); if (tblpm == null) { return(HttpNotFound()); } PmCheckPoint pm = new PmCheckPoint(); pm.pmCheckPoint = tblpm; ViewBag.plant = new SelectList(condb.tblplants.ToList().Where(p => p.IsDeleted == 0), "PlantID", "PlantName", tblpm.PlantID).ToList(); ViewBag.shop = new SelectList(condb.tblshops.ToList().Where(d => d.IsDeleted == 0), "ShopId", "ShopName", tblpm.ShopID).ToList(); ViewBag.cell = new SelectList(condb.tblcells.ToList().Where(d => d.IsDeleted == 0), "CellID", "CellName", tblpm.CellID).ToList(); return(View(pm)); } }
// GET: PmCheckPoint public ActionResult Index() { if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty)) { return(RedirectToAction("Login", "Login", null)); } ViewBag.Logout = Session["Username"].ToString().ToUpper(); ViewBag.roleid = Session["RoleID"]; PmCheckPoint tblpm = new PmCheckPoint(); tblpm.pmCheckPointlist = condb.configuration_tblpmcheckpoint.Where(m => m.Isdeleted == 0).ToList(); return(View(tblpm)); }