Beispiel #1
0
        public TodoOverviewResultModel TodoOverviewResultModel(TodoOverviewSearchModel searchModel)
        {
            TodoOverviewResultModel resultModel = new TodoOverviewResultModel();

            var entries = TodoRepository.GetItems().Where(p => p.DoDate >= searchModel.Startdatum && p.DoDate <= searchModel.Enddatum);

            if (!string.IsNullOrEmpty(searchModel.SearchText))
            {
                entries =
                    entries.Where(
                        p =>
                        p.Description.ToLower().Contains(searchModel.SearchText.ToLower().Trim()) ||
                        p.Creator.ToLower().Contains(searchModel.SearchText.ToLower().Trim()));
            }

            resultModel.Entries.AddRange(entries.Take(searchModel.PageSize).Select(p => new TodoEntry()
            {
                Prioritaet  = p.Prioritaet,
                Description = p.Description,
                IsOpen      = p.IsActive,
                Creator     = p.Creator,
                DoDate      = p.DoDate.ToString(),
                Id          = p.Id
            }));

            return(resultModel);
        }
Beispiel #2
0
        public TodoOverviewSearchModel InitTodoOverviewSearchModel()
        {
            TodoOverviewSearchModel model = new TodoOverviewSearchModel();

            return(model);
        }
 public JsonResult TodoOverviewResultModel(TodoOverviewSearchModel searchModel)
 {
     return(Json(TodoOverviewModelBuilder.TodoOverviewResultModel(searchModel), JsonRequestBehavior.AllowGet));
 }