public IActionResult Index(ChartModel model) { if (model.EntityId.Equals(Guid.Empty)) { return(NotFound()); } var entity = _entityFinder.FindById(model.EntityId); if (entity == null) { return(NotFound()); } model.Entity = entity; if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <Chart> filter = FilterContainerBuilder.Build <Chart>(); filter.And(n => n.EntityId == model.EntityId); if (model.Name.IsNotEmpty()) { filter.And(n => n.Name.Like(model.Name)); } if (model.GetAll) { List <Chart> result = _chartFinder.Query(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result; model.TotalItems = result.Count; } else { if (CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } PagedList <Chart> result = _chartFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; } model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult Get(Guid entityId) { var result = _chartFinder.Query(n => n.Where(f => f.EntityId == entityId)); return(JOk(result)); }