public ActionResult SignOut() { SSC_Ticket_Management.Models.User userObj = (SSC_Ticket_Management.Models.User)Session["currentUser"]; int type = userObj.Type; Session["currentUser"] = ""; if (type == 1) { return(RedirectToAction("AdminLogin", "Home")); } return(RedirectToAction("EmployeeLogin", "Home")); }
// GET: Employee public ActionResult Index() { if (Session["currentUser"] == "") { return(RedirectToAction("EmployeeLogin", "Home")); } SSC_Ticket_Management.Models.User userObj = (SSC_Ticket_Management.Models.User)Session["currentUser"]; Session["currentUser"] = userObj; string currentuser = userObj.UserName; using (SSC_TicketEntities Tic = new SSC_TicketEntities()) { List <Ticket> Ticket = Tic.Ticket_PerformCRUD("SELECTEmployee", null, null, null, null, currentuser, null).ToList(); return(View(Ticket.ToList())); } }
public ActionResult Create(Ticket Ticket) { if (Session["currentUser"] == "") { return(RedirectToAction("EmployeeLogin", "Home")); } SSC_Ticket_Management.Models.User userObj = (SSC_Ticket_Management.Models.User)Session["currentUser"]; Session["currentUser"] = userObj; string currentuser = userObj.UserName; if (ModelState.IsValid) { using (SSC_TicketEntities Tic = new SSC_TicketEntities()) { Ticket Tick = Tic.Ticket_PerformCRUD("INSERT", null, Ticket.Ticket_Title, Ticket.Ticket_Description, null, currentuser, null).FirstOrDefault(); Tic.SaveChanges(); } return(RedirectToAction("Index")); } return(View(Ticket)); }
public Models.User DoLogin(string userName, string password, int userType) { Models.User userObj = db.User.Where(i => i.UserName == userName && i.Password == password && i.Type == userType).FirstOrDefault(); return(userObj); }