public IEnumerable<SalesTeam> FindByCriteria(SalesTeamCriteria c) { return this.DbContext.SalesTeams.Where(o => (!c.IdSrh.HasValue || o.Id.Equals(c.IdSrh.Value)) && (!c.IdFromSrh.HasValue || o.Id >= c.IdFromSrh.Value) && (!c.IdToSrh.HasValue || o.Id <= c.IdToSrh.Value) && (String.IsNullOrEmpty(c.NameSrh) || o.Name.Contains(c.NameSrh)) ); }
public ActionResult GetData(SalesTeamCriteria c) { var m = new LigerGridModel(); this.BeforeGetData(c); var r = this.Service.FindByCriteria(c); this.AfterGetData(m, c, r); m.Total = r.RecordCount; r.Data.ForEach(o => { this.AddRowToGridModel(m, o); }); this.AfterBuildGridModel(m, c, r); return this.Json(m, JsonRequestBehavior.AllowGet); }
partial void BeforeGetData(SalesTeamCriteria c);
partial void AfterGetData(LigerGridModel gm, SalesTeamCriteria c, PagedModel<SalesTeam> pm);
partial void AfterBuildGridModel(LigerGridModel gm, SalesTeamCriteria c, PagedModel<SalesTeam> pm);