Esempio n. 1
0
        public async Task <IActionResult> AddDistrict(DistrictListViewModel model)
        {
            try
            {
                if (model.TypeSelection == 1)
                {
                    model.District.IsPrivate = true;
                    model.District.IsCharter = false;
                }
                else if (model.TypeSelection == 2)
                {
                    model.District.IsPrivate = false;
                    model.District.IsCharter = true;
                }
                else
                {
                    model.District.IsPrivate = false;
                    model.District.IsCharter = false;
                }
                model.District.Name = model.District.Name?.Trim();
                await _schoolService.AddDistrict(model.District);

                ShowAlertSuccess($"Added School District '{model.District.Name}'");
            }
            catch (GraException gex)
            {
                ShowAlertDanger("Unable to add School District: ", gex);
            }
            return(RedirectToAction("Districts", new { search = model.Search }));
        }
Esempio n. 2
0
        public async Task <IActionResult> AddDistrict(DistrictListViewModel model)
        {
            try
            {
                await _schoolService.AddDistrict(model.District.Name);

                ShowAlertSuccess($"Added School District '{model.District.Name}'");
            }
            catch (GraException gex)
            {
                ShowAlertDanger("Unable to add School District: ", gex);
            }
            return(RedirectToAction("Districts"));
        }