示例#1
0
        public static int updatemodel(trashtype str)
        {
            Model1 mo = new Model1();

            mo.Entry(str).State = System.Data.Entity.EntityState.Modified;
            return(mo.SaveChanges());
        }
示例#2
0
        public static int insert(trashtype str)
        {
            Model1 mo = new Model1();

            mo.trashtype.Add(str);
            return(mo.SaveChanges());
        }
示例#3
0
        public static int delete(int id)
        {
            Model1    mo   = new Model1();
            trashtype list = mo.trashtype.FirstOrDefault(p => p.typeId == id);

            mo.Entry(list).State = System.Data.Entity.EntityState.Deleted;
            return(mo.SaveChanges());
        }
示例#4
0
 public ActionResult updatemodel(trashtype str)
 {
     if (Class1.updatemodel(str) != 0)
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(RedirectToAction("update"));
     }
 }
示例#5
0
 public ActionResult insertmodel(trashtype str)
 {
     if (Class1.insert(str) != 0)
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(RedirectToAction("insert"));
     }
 }
示例#6
0
        public int insertmod(string name, string wei, string chu)
        {
            trashtype str = new trashtype();

            str.typeName = name;
            str.typeHarm = wei;
            str.typeWay  = chu;
            int t1 = Class1.insert(str);

            //JsonResult jsonResult = new JsonResult();
            if (t1 != 0)
            {
                return(t1);
            }
            else
            {
                return(t1);
            }
        }