public static int updatemodel(trashtype str) { Model1 mo = new Model1(); mo.Entry(str).State = System.Data.Entity.EntityState.Modified; return(mo.SaveChanges()); }
public static int insert(trashtype str) { Model1 mo = new Model1(); mo.trashtype.Add(str); return(mo.SaveChanges()); }
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()); }
public ActionResult updatemodel(trashtype str) { if (Class1.updatemodel(str) != 0) { return(RedirectToAction("Index")); } else { return(RedirectToAction("update")); } }
public ActionResult insertmodel(trashtype str) { if (Class1.insert(str) != 0) { return(RedirectToAction("Index")); } else { return(RedirectToAction("insert")); } }
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); } }