예제 #1
0
 public ActionResult Delete(int id)
 {
     using (LoveBankDBContext db = new LoveBankDBContext())
     {
         AppVer img = db.T_AppVer.Find(id);
         db.Delete<AppVer>(img);
         db.SaveChanges();
         db.Dispose();
         return Success("操作成功");
     }
 }
예제 #2
0
 public ActionResult Delete(int id)
 {
     using (LoveBankDBContext db = new LoveBankDBContext())
     {
         Notice notice = db.T_Notice.Find(id);
         db.Delete<Notice>(notice);
         db.SaveChanges();
         db.Dispose();
         return Success("操作成功");
     }
 }
예제 #3
0
        public ActionResult ChangeStateAdImg(int id, int state)
        {
            using (LoveBankDBContext db = new LoveBankDBContext())
            {
                AppVer img = db.T_AppVer.Find(id);

                img.State = state;
                db.Update<AppVer>(img);
                db.SaveChanges();
                db.Dispose();
                return Success("操作成功");
            }
        }
예제 #4
0
        public ActionResult Add()
        {
            using (LoveBankDBContext db = new LoveBankDBContext())
            {
                IList<Role> role = db.T_Role.AsQueryable<Role>().ToList();

                ViewData["UserRole"] = role;

                //部门组织
                var list = db.T_Department.AsQueryable<Department>().Where(x => x.Level <= 6).ToList();
                ViewData["Department_List"] = HelpSerializer.JSONSerialize<List<Department>>(list);
                db.Dispose();
                return PartialView();
            }
        }
예제 #5
0
        /// <summary>
        /// App推送消息标识
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult PushMsg(int id)
        {
            using (LoveBankDBContext db = new LoveBankDBContext())
            {
                Notice notice = db.T_Notice.Find(id);
                if (notice.State >= 1)
                {
                    return Json("已经推送,不能再推送");
                }
                notice.State = 1;

                db.Update<Notice>(notice);
                db.SaveChanges();
                db.Dispose();
                return Json("操作成功");
            }
        }
예제 #6
0
        public ActionResult Edit(int id)
        {
            using (LoveBankDBContext db = new LoveBankDBContext())
            {
                AdminUser user = db.T_AdminUser.Find(id);

                List<Role> role = db.T_Role.AsQueryable<Role>().ToList();

                ViewData["UserRole"] = role;

                //部门组织
                var list = db.T_Department.AsQueryable<Department>().Where(x => x.Level <= 6).ToList();
                if (list != null)
                {
                   ViewData["Department_List"] = HelpSerializer.JSONSerialize<List<Department>>(list);
                }
                db.Dispose();

                return PartialView(user);
            }
        }
예제 #7
0
        public ActionResult PostAdd(AdminUser model)
        {
            model.LoginTime = DateTime.Now;
            model.LoginIP =Utility.GetIP();
            using (LoveBankDBContext db = new LoveBankDBContext())
            {
                if (db.T_AdminUser.Count(u => u.UserName.Trim() == model.UserName.Trim()) > 0)
                {
                    db.Dispose();
                    return Error("用户已经存在");
                }

                db.T_AdminUser.Add(model);
                db.SaveChanges();
                return Success("操作成功");
            }
        }