コード例 #1
0
        public ActionResult AddAdmin(Shopping.Models.Admin admin)
        {
            admin.CreateTime = DateTime.Now;
            db.Admins.Add(admin);
            db.SaveChanges();
            var id = db.Admins.Max(x => x.AdminID);

            return(Content(id.ToString()));
        }
コード例 #2
0
        //验证管理员名称是否存在
        public ActionResult CheckName(Shopping.Models.Admin admin)
        {
            string flag = "ok";

            if (db.Admins.FirstOrDefault(a => a.AdminName == admin.AdminName) != null)
            {
                flag = "error";
            }
            return(Content(flag));
        }