예제 #1
0
        public JsonResult <List <Models.TaskDetails> > GetAllTaskDetailsSorted(string sortBy, bool ascending)
        {
            List <DataAccessLayer.TaskDetail> prodList = TaskEntities.GetAllTasks().AsQueryable().OrderByPropertyName(sortBy, ascending).ToList();
            var result = new List <DataAccessLayer.TaskDetail>();

            var taskObject = Mapper.Map <List <DataAccessLayer.TaskDetail>, List <Models.TaskDetails> >(prodList);

            return(Json(taskObject));
        }
예제 #2
0
        public JsonResult <List <Models.TaskDetails> > GetAllTaskDetails()
        {
            List <DataAccessLayer.TaskDetail> taskList = TaskEntities.GetAllTasks();
            List <Models.TaskDetails>         tasks    = new List <Models.TaskDetails>();


            List <Models.TaskDetails> taskObj = Mapper.Map <List <DataAccessLayer.TaskDetail>, List <Models.TaskDetails> >(taskList);

            return(Json(taskObj));
        }
예제 #3
0
        public JsonResult <List <Models.TaskDetails> > GetAllTaskDetailsFiltered([FromBody] SearchSortParameter request)
        {
            var result = TaskEntities.GetAllTasks();
            List <DataAccessLayer.TaskDetail>        prodList;
            IEnumerable <DataAccessLayer.TaskDetail> searchResult;

            if (!string.IsNullOrEmpty(request.Search))
            {
                searchResult = result.Where(x => x.Task.Contains(request.Search));
            }
            else
            {
                searchResult = result;
            }

            prodList = searchResult.AsQueryable().OrderByPropertyName(request.SortBy, request.Ascending).ToList();

            var taskObj = Mapper.Map <List <DataAccessLayer.TaskDetail>, List <Models.TaskDetails> >(prodList);

            return(Json(taskObj));
        }