Esempio n. 1
0
        public ActionResult AddEducation(AddEducationViewModel viewModel)
        {
            ModelState.Clear();
            var validation = TryValidateModel(viewModel);
            var errors     = (from modelstate in ModelState.Values from error in modelstate.Errors select error.ErrorMessage).ToList();

            if (!validation)
            {
                return(Json(errors.ToArray()));
            }

            _studentFacade.InsertPrevEducation(viewModel.Education, User.Identity.Name);
            errors.Add("Finish");
            return(Json(errors.ToArray()));
        }