public ActionResult Create(FormCollection collection) { try { T_CH_Checkfunc newitem = new T_CH_Checkfunc(); TryUpdateModel <T_CH_Checkfunc>(newitem, collection); db.T_CH_Checkfunc.Add(newitem); db.SaveChanges(); return(this.Direct(true)); } catch { return(this.Direct(false)); } }
public ActionResult Edit(T_CH_Checkfunc collection) { try { T_CH_Checkfunc obj_or = new T_CH_Checkfunc(); foreach (var item in typeof(T_CH_Checkfunc).GetProperties()) { item.SetValue(obj_or, item.GetValue(collection, null), null); } db.Entry(obj_or).State = System.Data.EntityState.Modified; db.SaveChanges(); return(this.Direct(true)); } catch { return(this.Direct(false)); } }