partial void AfterUpdateData(Clazz e, ref ActionResult ar) { ar = this.Json(new AjaxOperationResult { Data = this.ToJson(e), Successful = true }); }
public ActionResult Add(Clazz 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 object ToJson(Clazz e) { return new { Id=e.Id, Name=e.Name, Semester=e.Semester, StudentQty=e.StudentQty, LimitedQty=e.LimitedQty, TeacherA=e.TeacherA, TeacherB=e.TeacherB, Master=e.Master, Governor=e.Governor, OpenDate=e.OpenDate, ClosedDate=e.ClosedDate, FinishedDate=e.FinishedDate, IsOpen=e.IsOpen, IsClosed=e.IsClosed, IsFinished=e.IsFinished, CreateTime=e.CreateTime, UpdateTime=e.UpdateTime, KickOffDate=e.KickOffDate }; }
private void FixupClazz(Clazz previousValue) { if (previousValue != null && previousValue.Student.Contains(this)) { previousValue.Student.Remove(this); } if (Clazz != null) { if (!Clazz.Student.Contains(this)) { Clazz.Student.Add(this); } if (ClazzId != Clazz.Id) { ClazzId = Clazz.Id; } } else if (!_settingFK) { ClazzId = null; } }
partial void AfterUpdateData(Clazz e, ref ActionResult ar);
partial void AfterAddData(Clazz e, ref ActionResult ar);
partial void AddRowToGridModel(LigerGridModel m, Clazz e) { m.Rows.Add(this.ToJson(e)); }
partial void AddRowToGridModel(LigerGridModel m, Clazz e);
partial void BeforeShowEditView(Clazz e);
partial void BeforeUpdateData(Clazz e, ref ActionResult ar);
partial void BeforeAddData(Clazz e, ref ActionResult ar);
public void Delete(Clazz entity) { this.Repository.Delete(entity); this.Db.Save(); }
public void Add(Clazz entity) { this.Repository.Add(entity); this.Db.Save(); }
public void Update(Clazz entity) { this.Repository.Update(entity); this.Db.Save(); }
public void Save(Clazz entity) { if(entity.Id==0){ this.Add(entity); }else{ this.Db.Save(); } }