コード例 #1
0
        public ActionResult Delete(int id)
        {
            if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty))
            {
                return(RedirectToAction("Login", "Login", null));
            }
            ViewBag.Logout = Session["Username"];
            ViewBag.roleid = Session["RoleID"];
            String Username = Session["Username"].ToString();
            int    UserID1  = id;
            //ViewBag.IsConfigMenu = 0;

            //start Logging
            int    UserID = Convert.ToInt32(Session["UserId"]);
            string CompleteModificationdetail = "Deleted Role";

            Action = "Delete";
            ActiveLogStorage Obj = new ActiveLogStorage();

            Obj.SaveActiveLog(Action, Controller, Username, UserID, CompleteModificationdetail);
            //End
            tblmachinecategory tblmc = db.tblmachinecategories.Find(id);

            tblmc.IsDeleted       = 1;
            db.Entry(tblmc).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult Create(tblmachinecategory tblmc)
        {
            if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty))
            {
                return(RedirectToAction("Login", "Login", null));
            }
            ViewBag.Logout = Session["Username"];
            ViewBag.roleid = Session["RoleID"];
            String Username = Session["Username"].ToString();


            //ActiveLog Code
            int    UserID = Convert.ToInt32(Session["UserId"]);
            string CompleteModificationdetail = "New Creation";

            Action = "Create";
            ActiveLogStorage Obj = new ActiveLogStorage();

            Obj.SaveActiveLog(Action, Controller, Username, UserID, CompleteModificationdetail);
            //End
            db.tblmachinecategories.Add(tblmc);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }