Example #1
0
        // GET: Dashboard/Cases
        public async Task <IActionResult> Index(
            string sortOrder,
            string currentFilter,
            string searchString,
            int?page,
            bool showDisabled = false)
        {
            ViewData["CurrentSort"]          = sortOrder;
            ViewData["NameSortParm"]         = string.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewData["DateSortParm"]         = sortOrder == "Date" ? "date_desc" : "Date";
            ViewData["LastModifiedSortParm"] = sortOrder == "LastModified" ? "last_desc" : "LastModified";

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewData["CurrentFilter"] = searchString;
            ViewBag.ShowDisabled      = showDisabled;
            var cases = _caseRepository.GetAll().Where(c => !c.Deleted && (c.Enabled || showDisabled) && (string.IsNullOrEmpty(searchString) || c.Title.Contains(searchString)));

            switch (sortOrder)
            {
            case "name_desc":
                cases = cases.OrderByDescending(c => c.Title);
                break;

            case "Date":
                cases = cases.OrderBy(c => c.Date);
                break;

            case "date_desc":
                cases = cases.OrderByDescending(c => c.Date);
                break;

            case "LastModified":
                cases = cases.OrderBy(c => c.LastModified);
                break;

            case "last_desc":
                cases = cases.OrderByDescending(c => c.LastModified);
                break;

            default:
                cases = cases.OrderBy(c => c.Title);
                break;
            }
            return(View(new CaseViewModel
            {
                CasesList = await PaginatedList <Case> .Create(cases, page ?? 1, 5),
                CasesWithoutTranslation = await _itemTranslationRepository.GetCasesWithoutTranslation()
            }));
        }
        public async Task <IActionResult> Index()
        {
            var language = HttpContext?.Features?.Get <IRequestCultureFeature>()?.RequestCulture?.Culture
                           ?.TwoLetterISOLanguageName ?? "nl";
            var list = await _caseRepository.GetAll().Include(c => c.Customer).Where(c => c.Enabled && !c.Deleted && c.Language == language).OrderByDescending(c => c.Date).ToListAsync();

            return(View(list));
        }
Example #3
0
 public ActionResult <IEnumerable <Case> > Get()
 {
     try
     {
         return(StatusCode(200, _caseRepository.GetAll()));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }
Example #4
0
        public IActionResult GetAll()
        {
            var cases = CaseRepository.GetAll();

            if (cases == null)
            {
                return(NotFound());
            }

            else
            {
                return(Ok(cases));
            }
        }