Esempio n. 1
0
        public async Task <IActionResult> AddRule(AdminSectionViewModel adminViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            await _ruleFacade.Insert(new RuleDTO()
            {
                Regex = adminViewModel.NewRule.Regex
            });

            return(RedirectToActionPermanent(nameof(Index)));
        }
Esempio n. 2
0
        public async Task <IActionResult> Index()
        {
            var layout = new AdminSectionViewModel
            {
                Title      = "Admin Section",
                Algorithms = await _algoFacade.GetAllWithStats(),
                Rules      = await _ruleFacade.GetAll(),
                NewRule    = new RuleViewModel(),
                Stats      = await _statsFacade.CreateStats()
            };

            InitializeLayoutModel(layout);

            return(View(layout));
        }