public ActionResult Add(SmallInfoSource e) { ActionResult ar = null; try { this.BeforeAddData(e, ref ar); if (ar == null) { this.Service.Add(e); e = this.Service.FindById(e.Id); //ar = this.Json(new AjaxOperationResult { Data = e, Successful = true }); this.AfterAddData(e, ref ar); } } catch (Exception ex) { ar = this.Json(new AjaxOperationResult { Successful = false, Message = ex.Message }); } return ar; }
private void FixupInfoSourceSmall(SmallInfoSource previousValue) { if (previousValue != null && previousValue.Students.Contains(this)) { previousValue.Students.Remove(this); } if (InfoSourceSmall != null) { if (!InfoSourceSmall.Students.Contains(this)) { InfoSourceSmall.Students.Add(this); } if (SmallInfoSourceId != InfoSourceSmall.Id) { SmallInfoSourceId = InfoSourceSmall.Id; } } else if (!_settingFK) { SmallInfoSourceId = null; } }
partial void BeforeShowEditView(SmallInfoSource e);
partial void BeforeUpdateData(SmallInfoSource e, ref ActionResult ar);
partial void AfterUpdateData(SmallInfoSource e, ref ActionResult ar);
partial void AddRowToGridModel(LigerGridModel m, SmallInfoSource e);
public void Delete(SmallInfoSource entity) { this.Repository.Delete(entity); this.Db.Save(); }
public void Add(SmallInfoSource entity) { this.Repository.Add(entity); this.Db.Save(); }
public void Save(SmallInfoSource entity) { if(entity.Id==0){ this.Add(entity); }else{ this.Db.Save(); } }