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

            string[] proNames;

            proNames = new string[] { "guarantee_way_name", "amount_guaranteed" };


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


            DbEntityEntry entry = ef.Entry <guarantee_way>(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/GuaranteeWay/index");
            }
            else
            {
                str = StringAlert.Alert("担保方式修改失败!", "/admin/GuaranteeWay/Edit?id=" + p.guarantee_way_id);
            }
            return(Content(str, "text/html"));
        }
Ejemplo n.º 2
0
        public ActionResult AddPost(guarantee_way p)
        {
            p            = (guarantee_way)Utils.ValidateModelClass(p);
            p.createtime = DateTime.Now;
            ef.guarantee_way.Add(p);
            //ef.SaveChanges();
            string str = "";
            int    i   = ef.SaveChanges();

            if (i > 0)
            {
                str = StringAlert.Alert("担保方式添加成功!", "/admin/GuaranteeWay/Index");
            }
            else
            {
                str = StringAlert.Alert("担保方式添加失败!", "/admin/GuaranteeWay/Add/");
            }
            return(Content(str, "text/html"));
        }
Ejemplo n.º 3
0
        public ActionResult DelById(int id, int Page = 1, string guarantee_way_name = "")
        {
            string str = "";

            guarantee_way pDel = new guarantee_way()
            {
                guarantee_way_id = id
            };

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

            if (i > 0)
            {
                str = StringAlert.Alert("担保方式删除成功!", "/admin/GuaranteeWay/Index?page=" + Page.ToString() + "&guarantee_way_name=" + guarantee_way_name);
            }
            else
            {
                str = StringAlert.Alert("担保方式删除失败!", "/admin/GuaranteeWay/Index?page=" + Page.ToString() + "&guarantee_way_name=" + guarantee_way_name);
            }
            return(Content(str, "text/html"));
        }