Beispiel #1
0
        public IActionResult JobForm()
        {
            var model = new JobFormInputModel
            {
                University = "SoftUni",
                Cities     = this.service.GetAll()
            };

            return(View(model));
        }
Beispiel #2
0
        public IActionResult JobForm(JobFormInputModel input)
        {
            if (input.City > 3)
            {
                // this.ModelState.AddModelError("City", "Невалиден град!");
                this.ModelState.AddModelError(nameof(JobFormInputModel.City), "Невалиден град!");
            }

            if (!this.ModelState.IsValid)
            {
                input.Cities = this.service.GetAll();
                return(this.View(input));
            }

            return(Json(input));
        }