示例#1
0
        // GET: User
        public ActionResult Index()
        {
            UserDBHandle dbhandle = new UserDBHandle();

            ModelState.Clear();
            return(View(dbhandle.GetLogins()));
        }
示例#2
0
 public ActionResult Edit(int id, Employee login)
 {
     try
     {
         //login.ID = id;
         UserDBHandle db = new UserDBHandle();
         db.UpdateDetails(login);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#3
0
 public ActionResult Delete(int id)
 {
     try
     {
         UserDBHandle db = new UserDBHandle();
         if (db.DeleteUser(id))
         {
             ViewBag.AlertMsg = "User Deleted Successfully";
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#4
0
 public ActionResult Create(Employee login)
 {
     try
     {
         if (ModelState.IsValid)
         {
             UserDBHandle db = new UserDBHandle();
             if (db.AddUser(login))
             {
                 ViewBag.Message = "User Details Added Successfully";
                 ModelState.Clear();
             }
         }
         return(View());
     }
     catch
     {
         return(View());
     }
 }
示例#5
0
        public ActionResult Autherize(Project.Models.Login login)
        {
            UserDBHandle dbb = new UserDBHandle();

            using (OOSEPROJECTEntities db = new OOSEPROJECTEntities())
            {
                var user        = db.Logins.Where(x => x.UserName == login.UserName && x.UserPassword == login.UserPassword).FirstOrDefault();
                var userDetails = dbb.GetLogins().Find(smodel => smodel.ID == user.UserID);
                if (user == null)
                {
                    login.LoginErrorMessage = "Wrong Username or Password";
                    return(View("Index", login));
                }
                else if (userDetails.UserType == "admin")
                {
                    Session["userID"]   = user.UserID;
                    Session["userName"] = user.UserName;
                    Session["userType"] = userDetails.UserType;
                    return(RedirectToAction("Index", "Home"));
                }
                else if (userDetails.UserType == "customer")
                {
                    Session["userID"]   = user.UserID;
                    Session["userName"] = user.UserName;
                    Session["userType"] = userDetails.UserType;
                    return(RedirectToAction("IndexC", "Home"));
                }
                else if (userDetails.UserType == "employee")
                {
                    Session["userID"]   = user.UserID;
                    Session["userName"] = user.UserName;
                    Session["userType"] = userDetails.UserType;
                    return(RedirectToAction("IndexE", "Home"));
                }
                else
                {
                    login.LoginErrorMessage = "Enter valid type!";
                    return(View("Index", login));
                }
            }
        }
示例#6
0
        public ActionResult Edit(int id)
        {
            UserDBHandle db = new UserDBHandle();

            return(View(db.GetLogins().Find(smodel => smodel.ID == id)));
        }