public ActionResult CreateProfession(CreateProfessionModel dataModel) { Ability newAbilities = new Ability(); newAbilities.SkillId = dataModel.SkillId; newAbilities.SkillLevelId = dataModel.SkillLevelId; if (_abilRepository.Create(newAbilities)) { _abilRepository.Save(); } if (newAbilities.Id == 0) { //TODO Repalce with error page return(Redirect("/Home/Index")); } AbilitySet newAbilSet = new AbilitySet(); newAbilSet.AbilitiesId = newAbilities.Id; newAbilSet.ApplianceId = 0; if (_abilSetRepository.Create(newAbilSet)) { _abilSetRepository.Save(); } if (newAbilSet.Id == 0) { //TODO Repalce with error page return(Redirect("/Home/Index")); } Profession newProfession = new Profession(); newProfession.Name = dataModel.ProfessionData.Name; newProfession.AbilitySetId = newAbilSet.Id; if (_profRepo.Create(newProfession)) { _profRepo.Save(); } return(Redirect("/CreateVacancy/Index")); }
public ActionResult NewProfession() { CreateProfessionModel newProfession = new CreateProfessionModel(); List <SelectListItem> skills = _skillsRepository.GetAll(). Select(r => new SelectListItem { Value = r.Id.ToString(), Text = r.SkillName }). ToList(); List <SelectListItem> skillLevels = _skillsRepository.GetSkillLevels(). Select(r => new SelectListItem { Value = r.Id.ToString(), Text = r.ValueName }). ToList(); ViewBag.Skills = skills; ViewBag.SkillLevels = skillLevels; return(View(newProfession)); }