Ejemplo n.º 1
0
        public ActionResult EditPost(hx_Project_type p)
        {
            string str = "";

            string[] proNames;

            proNames = new string[] { "project_type_name" };


            p = (hx_Project_type)Utils.ValidateModelClass(p);


            DbEntityEntry entry = ef.Entry <hx_Project_type>(p);

            entry.State = EntityState.Unchanged;

            foreach (string ProName in proNames)
            {
                entry.Property(ProName).IsModified = true;
            }

            int i = ef.SaveChanges();

            if (i > 0)
            {
                str = StringAlert.Alert("项目类型修改成功!", "/Admin/ProjectType/index");
            }
            else
            {
                str = StringAlert.Alert("项目类型修改失败!", "/admin/ProjectType/Edit?id=" + p.project_type_id);
            }
            return(Content(str, "text/html"));
        }
Ejemplo n.º 2
0
        public ActionResult AddPost(hx_Project_type p)
        {
            p = (hx_Project_type)Utils.ValidateModelClass(p);

            ef.hx_Project_type.Add(p);
            //ef.SaveChanges();
            string str = "";
            int    i   = ef.SaveChanges();

            if (i > 0)
            {
                str = StringAlert.Alert("项目类型添加成功!", "/admin/ProjectType/Index");
            }
            else
            {
                str = StringAlert.Alert("项目类型添加失败!", "/admin/ProjectType/Add/");
            }
            return(Content(str, "text/html"));
        }
Ejemplo n.º 3
0
        public ActionResult DelById(int id, int Page = 1, string project_type_name = "")
        {
            string str = "";

            hx_Project_type pDel = new hx_Project_type()
            {
                project_type_id = id
            };

            ef.hx_Project_type.Attach(pDel);
            ef.hx_Project_type.Remove(pDel);
            int i = ef.SaveChanges();

            if (i > 0)
            {
                str = StringAlert.Alert("项目类型删除成功!", "/admin/ProjectType/Index?page=" + Page.ToString() + "&project_type_name=" + project_type_name);
            }
            else
            {
                str = StringAlert.Alert("项目类型删除失败!", "/admin/ProjectType/Index?page=" + Page.ToString() + "&project_type_name=" + project_type_name);
            }
            return(Content(str, "text/html"));
        }