示例#1
0
        public IActionResult Index(AlertViewModel alertVM)
        {
            var pageNumber = (alertVM.Pnumber == 0) ? 1 : alertVM.Pnumber;
            var pageSize   = 10;
            var alerts     = _AlertRepository.GetAll().ToPagedList(pageNumber, pageSize);

            alertVM.Alerts = alerts;
            string[] variables = new string[] { "createResult", "editResult", "deleteResult" };
            initializeTempData(variables);
            return(View(alertVM));
        }
示例#2
0
        public async Task <Dictionary <string, List <AlertOutput> > > Execute()
        {
            Dictionary <string, List <AlertOutput> > dicAlert = new Dictionary <string, List <AlertOutput> >();
            List <AlertOutput> alert = _mapper.Map <List <Domain.Alert.Alert>, List <AlertOutput> >(await _alertRepository.GetAll());

            List <string> listAlertType = alert.AsEnumerable().Select(x => x.AlertType).ToList();

            foreach (string alertType in listAlertType)
            {
                if (!dicAlert.ContainsKey(alertType))
                {
                    dicAlert.Add(alertType, alert.AsEnumerable().Where(x => x.AlertType == alertType).Select(x => x).ToList());
                }
            }

            return(dicAlert);
        }