Ejemplo n.º 1
0
        public ActionResult Del_Training(int id)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            Training ids  = db.Training.Find(id);
            Training idss = db.Training.Remove(ids);
            int      num  = db.SaveChanges();

            dic.Add("res", num > 0 ? true : false);
            return(Json(dic, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult UpdetSalary(staffInfo p)
        {
            Dictionary <string, bool> dic = new Dictionary <string, bool>();
            var info = db.staffInfo.Find(p.empId);

            info.empBonus  = p.empBonus;
            info.empSalary = p.empSalary;
            int num = db.SaveChanges();

            dic.Add("res", num > 0 ? false : true);
            return(Json(dic));
        }
Ejemplo n.º 3
0
        public ActionResult Add_detpart(staffInfo p)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            db.staffInfo.Add(p);
            int num = db.SaveChanges();

            dic.Add("res", num > 0 ? true : false);
            return(Json(dic));
        }
Ejemplo n.º 4
0
        public ActionResult Del_User(int id)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            userChecke ids = db.userChecke.Find(id);

            _ = db.userChecke.Remove(ids);
            int num = db.SaveChanges();

            dic.Add("res", num > 0 ? true : false);
            return(Json(dic, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        //上传用户头像
        public ActionResult UpdetImg(HttpPostedFileBase file, int userID)
        {
            //获取文件名
            string fileName = Path.GetFileName(file.FileName);
            //创建一个路径
            string path = Server.MapPath("~/images/");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            file.SaveAs(path + fileName);
            string   url = "/style/img/" + fileName;
            userinfo ids = db.userinfo.Find(userID);

            ids.userPhot = url;
            db.SaveChanges();
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("res", true);
            return(Json(dic));
        }
Ejemplo n.º 6
0
        public ActionResult Checks(userChecke p)
        {
            bool result            = false;
            List <userChecke> list = db.userChecke.Where(u => u.userName == p.userName).ToList();

            if (list.Count > 0)
            {
                result = false;
            }
            else
            {
                db.userChecke.Add(p);
                db.SaveChanges();
                result = true;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }