示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_ManageUsers tbl_ManageUsers = db.tbl_ManageUsers.Find(id);

            db.tbl_ManageUsers.Remove(tbl_ManageUsers);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Create([Bind(Include = "userid,username,password,role,emailid,activitystatus,createdby,createddate,modifiedby,modifieddate,FKdesignationid")] tbl_ManageUsers tbl_ManageUsers)
 {
     if (ModelState.IsValid)
     {
         var mail = Convert.ToString(Session["useremail"]);
         tbl_ManageUsers.createdby   = mail;
         tbl_ManageUsers.createddate = DateTime.Now;
         db.tbl_ManageUsers.Add(tbl_ManageUsers);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FKdesignationid = new SelectList(db.tbl_Designation, "id", "departmentname", tbl_ManageUsers.FKdesignationid);
     return(View(tbl_ManageUsers));
 }
示例#3
0
        // GET: Admin/UserManage/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_ManageUsers tbl_ManageUsers = db.tbl_ManageUsers.Find(id);

            if (tbl_ManageUsers == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_ManageUsers));
        }
示例#4
0
        // GET: Admin/UserManage/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_ManageUsers tbl_ManageUsers = db.tbl_ManageUsers.Find(id);

            if (tbl_ManageUsers == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FKdesignationid = new SelectList(db.tbl_Designation, "id", "departmentname", tbl_ManageUsers.FKdesignationid);
            return(View(tbl_ManageUsers));
        }
示例#5
0
        public ActionResult UserLogin(tbl_ManageUsers data)
        {
            try
            {
                var Logindata = db.tbl_ManageUsers.SingleOrDefault(a => a.username == data.username && a.password == data.password);
                if (Logindata != null)
                {
                    Session["userId"]    = Logindata.userid;
                    Session["useremail"] = Logindata.username;
                    TempData["msg"]      = "Login Done!";

                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    TempData["err"] = "Username or Password is Wrong!!";
                }
            }
            catch (Exception ex)
            {
                TempData["err"] = ex.Message;
            }
            return(View());
        }