Beispiel #1
0
        public async Task <IActionResult> AddSubjectCategory(SubjectCategoryBindingModel subjectCategoryBindingModel)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index"));
            }

            var subjectCategoryModel = new SubjectCategoryModel
            {
                Description = subjectCategoryBindingModel.Description
            };
            var successful = await _subjectCategoryService.AddSubjectCategoryAsync(subjectCategoryModel);

            if (!successful)
            {
                return(BadRequest("Could not add the subject category"));
            }

            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public IActionResult AddSubjectCategory()
        {
            var bindingModel = new SubjectCategoryBindingModel();

            return(View(bindingModel));
        }