Ejemplo n.º 1
0
        /*[HttpGet]
         * [Route("CheckBoardName")]
         * public JsonResult CheckBoardName(string Name)
         * {
         *  var result = _br.HasRepeatedBoardName(id, Name);
         *  return Json(result, JsonRequestBehavior.AllowGet);
         * }
         */
        #endregion

        #region Auxiliar Methods
        public IEnumerable <BoardViewModel> SortingFilteringPaging(string sortOrder, string searchString, int pagenumber)
        {
            IEnumerable <BoardViewModel> boards;

            switch (sortOrder)
            {
            case BoardVMConstants.NameDesc:
                boards = VMConverters.ModelsToViewModels(_br.GetAllPaging(e => e.Name, SortDirection.Descending, searchString, pagenumber, PageSize));
                break;

            case BoardVMConstants.DiscriptionAsc:
                boards = VMConverters.ModelsToViewModels(_br.GetAllPaging(e => e.Discription, SortDirection.Ascending, searchString, pagenumber, PageSize));
                break;

            case BoardVMConstants.DiscriptionDesc:
                boards = VMConverters.ModelsToViewModels(_br.GetAllPaging(e => e.Discription, SortDirection.Descending, searchString, pagenumber, PageSize));
                break;

            default:     // Name ascending
                boards = VMConverters.ModelsToViewModels(_br.GetAllPaging(e => e.Name, SortDirection.Ascending, searchString, pagenumber, PageSize));
                break;
            }
            return(boards);
        }