public ActionResult EditRow(int? id, string Name, string Type, string NickName, string oper) { if (oper == JqGridOperations.add.ToString()) { Supporter sp = new Supporter() { Name = Name, NickName = NickName, Status = EntityStatuses.Actived.ToString(), Type = string.IsNullOrEmpty(Type)? SupportTypes.Yahoo.ToString() : Type, }; new SupporterService().Add(sp); return Content("true"); } if (oper == JqGridOperations.edit.ToString()) { new SupporterService().Edit(id.Value, NickName, Name); } if(oper == JqGridOperations.del.ToString()){ new SupporterService().Delete(id.Value); } return Content("true"); }
public ActionResult EditRow(int? id, string Name, string Type, string NickName, string oper) { if (oper == JqGridOperations.add.ToString()) { Supporter sp = new Supporter() { Name = Name, NickName = NickName, Status = EntityStatuses.Actived.ToString(), Type = Type, }; SupporterService.Add(sp); return Content("true"); } if(oper == JqGridOperations.del.ToString()){ SupporterService.Delete(id.Value); } return Content("true"); }
public ActionResult EditSupporter(int id, Supporter supporter) { DBNLDataContext db = new DBNLDataContext(); Supporter sp = db.Supporters.Where(p => p.Id == id).SingleOrDefault(); sp.Name = supporter.Name; sp.NickName = supporter.NickName; sp.Status = supporter.Status; sp.Type = supporter.Type; db.SubmitChanges(); return RedirectToAction("ListSupporter"); }
public ActionResult DeleteSupporter(Supporter supporter) { DBNLDataContext db = new DBNLDataContext(); db.Supporters.DeleteOnSubmit(supporter); db.SubmitChanges(); return RedirectToAction("ListSupporters"); }
public ActionResult Create(Supporter supporter) { new SupporterService().Create(supporter); return RedirectToAction("Index"); }
partial void DeleteSupporter(Supporter instance);
partial void UpdateSupporter(Supporter instance);
partial void InsertSupporter(Supporter instance);