public ActionResult AddSkillToUser(SkillViewModel model)
        {
            _skillAreaService.CreateSkillAreaEntity(model.Category);

            int areaId = _skillAreaService.GetIdByAreaName(model.Category);
            _skillTypeService.CreateSkillTypeEntity(model.Name, areaId);

            int typeId = _skillTypeService.GetIdByType(model.Name);
            int profileId = _profileService.GetProfileByUserID(_userService.GetUserByEmail(User.Identity.Name).ID).ID;
            _skillService.CreateSkillEntity(model.Mark, typeId, profileId);

            return RedirectToAction("ShowSkills");
        }
Пример #2
0
        public static IEnumerable<SkillViewModel> ToSkillViewList(this IEnumerable<SkillEntity> skills,
            IEnumerable<SkillAreaEntity> categories,
            IEnumerable<SkillTypeEntity> names)
        {
            var result = new List<SkillViewModel>();

            for (int i = 0; i < skills.Count(); i++)
            {
                SkillViewModel skillModel = new SkillViewModel() 
                { 
                    ID = skills.ElementAt(i).ID,
                    Mark = skills.ElementAt(i).Mark,
                    Category = categories.ElementAt(i).AreaName, 
                    Name = names.ElementAt(i).Name 
                };
                result.Add(skillModel);
            }

            return result;
        }