コード例 #1
0
ファイル: SkillsController.cs プロジェクト: wpank/Springboard
        public ActionResult SkillCreatePartialJobPosting(JobPosting model)
        {
            SkillRequirement Skill     = new SkillRequirement();
            List <Trait>     listItems = new List <Trait>();

            foreach (var prop in from s in Skill.GetType().GetProperties() select s)
            {
                if (!prop.PropertyType.Equals(typeof(int?)))
                {
                    continue;
                }
                Trait item = new Trait
                {
                    DisplayName  = prop.Name,
                    PropertyName = prop.Name
                };
                listItems.Add(item);
            }
            SkillCreateViewModel viewModel = new SkillCreateViewModel
            {
                CreatorType = SkillCreatorType.JobPosting,
                CreatorId   = model.Id,
                Traits      = listItems
            };

            return(PartialView("SkillCreatePartial", viewModel));
        }
コード例 #2
0
        public ActionResult Create()
        {
            logger.Info($"Action Start | Controller name: {nameof(SkillsController)} | Action name: {nameof(Create)}");

            SkillCreateViewModel skillCreateViewModel = new SkillCreateViewModel
            {
                Algorithms = new SelectList(Skill.algorithmDictionary.Select(algo => new { Algorithm = algo.Key.ToString(), AlgorithmName = algo.Value }), "Algorithm", "AlgorithmName", 0)
            };

            return(View(skillCreateViewModel));
        }
コード例 #3
0
        public async Task <ActionResult> Edit(int?id)
        {
            logger.Info($"Action Start | Controller name: {nameof(SkillsController)} | Action name: {nameof(Edit)} | Input params: {nameof(id)}={id}");
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Skill skill = await repository.FindSkillByIdAsync(id);

            if (skill == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }
            SkillCreateViewModel skillCreateViewModel = new SkillCreateViewModel
            {
                Skill      = skill,
                Algorithms = new SelectList(Skill.algorithmDictionary.Select(algo => new { Algorithm = algo.Key.ToString(), AlgorithmName = algo.Value }), "Algorithm", "AlgorithmName", skill.Algorithm)
            };

            return(View(skillCreateViewModel));
        }