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