public ActionResult AddSession(FormCollection formCollection) { if (Request.Cookies["AdminType"].Value.ToString() == "Sub") { ViewBag.ErrorMessage = "You are not authorized to add more Sessions!!"; return(View()); } else { Session session = new Session(); session.DegreeTitle = formCollection["DegreeTitle"].ToString(); session.DegreeSession = formCollection["DegreeSession"].ToString(); session.TimeStamp = DateTime.Now.ToString("MMM dd yyyy/ddd/hh:mm"); session.AddingEmployeeId = Request.Cookies["EmployeeId"].Value.ToString(); SessionDbLayer sessionDbLayer = new SessionDbLayer(); try { sessionDbLayer.AddSession(session); ViewBag.SuccessMessage = "Session Added Successfully!!"; return(View()); } catch { ViewBag.ErrorMessage = "Invalid Session..!! <br/> This Session Allready Exists"; return(View()); } } }
public ActionResult DeleteSession(string Session) { try { if (Request.Cookies["AdminType"].Value.ToString() != null) { SessionDbLayer sessionDbLayer = new SessionDbLayer(); if (Request.Cookies["AdminType"].Value.ToString().Equals("Main")) { sessionDbLayer.DeleteSession(Session); return(RedirectToAction("ListAllSession")); } else { //TempData["DeleteValidationMessage"] = "You are Not Authorized to Delete a Session"; return(RedirectToAction("ListAllSession")); } } else { return(RedirectToAction("Login", "Admin")); } } catch { return(RedirectToAction("Login", "Admin")); } }
public ActionResult ListAllSession() { try { if (Request.Cookies["AdminType"].Value.ToString() != null) { SessionDbLayer sessionDbLayer = new SessionDbLayer(); return(View(sessionDbLayer.ListAllSession())); } else { return(RedirectToAction("Login", "Admin")); } } catch { return(RedirectToAction("Login", "Admin")); } }