コード例 #1
0
 public IActionResult ListarSkills()
 {
     try
     {
         return(Ok(_mapperSkill.GetAll()));
     }
     catch (Exception ex)
     {
         return(BadRequest(new{ Erro = ex.ToString() }));
     }
 }
コード例 #2
0
        public async Task <IActionResult> Index()
        {
            var skills = await _skillService.GetAll();

            var sliders = await _homePageSliderService.GetAll();

            var messages = await _messageService.GetAll();

            var educations = await _educationService.GetAll();

            var experiences = await _experienceService.GetAll();

            var interesteds = await _interestedService.GetAll();

            var articles = await _articleService.GetAll();

            var categories = await _categoryService.GetAll();

            ViewBag.SkillCount      = skills.Data.Skills.Count;
            ViewBag.SliderCount     = sliders.Data.HomePageSliders.Count;
            ViewBag.MessageCount    = messages.Data.Messages.Count;
            ViewBag.EducationCount  = educations.Data.Educations.Count;
            ViewBag.ExperienceCount = experiences.Data.Experiences.Count;
            ViewBag.InterestedCount = interesteds.Data.Interesteds.Count;
            ViewBag.ArticleCount    = articles.Data.Articles.Count;
            ViewBag.CategoryCount   = categories.Data.Categories.Count;
            return(View());
        }
コード例 #3
0
        public IActionResult GetByResumeId(int resumeId)
        {
            var entities = _skillService.GetAll(resumeId);
            var model    = entities.ToModels();

            return(Ok(model));
        }
コード例 #4
0
        public IActionResult Get()
        {
            try
            {
                //throw new Exception("Exception while fetching all the user from the storage.");
                _logger.LogInfo("In Get");

                var skills = _skillService.GetAll();
                if (skills == null)
                {
                    _logger.LogInfo("No Skills Fetched");
                }
                else
                {
                    _logger.LogInfo(skills.Count().ToString() + "Skills Fetched");
                }

                return(Ok(skills));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(BadRequest());
            }
        }
コード例 #5
0
        private IEnumerable <SelectListItem> GetCategories()
        {
            var sections = _sectionService.GetAll();
            var skills   = _skillService.GetAll();

            var groups = (from se in sections
                          select new SelectListGroup()
            {
                Name = se.Title
            }).ToList();

            var skillsWithSections = (from se in sections
                                      join sk in skills on se.Id equals sk.SectionId
                                      select new
            {
                Id = sk.Id,
                Title = sk.Title,
                SectionTitle = se.Title
            }).ToList();

            var groupData = (from sk in skillsWithSections
                             select new SelectListItem()
            {
                Value = sk.Id.ToString(),
                Text = sk.Title,
                Group = groups.First(sec => sec.Name.Equals(sk.SectionTitle))
            }).ToList();

            return(groupData);
        }
コード例 #6
0
        public async Task <ActionResult> Skills(string message)
        {
            TempData["message"] = message;
            IEnumerable <SkillViewModel> viewModel = _mapper.Map <IEnumerable <SkillDTO>, IEnumerable <SkillViewModel> >
                                                         (await _skillService.GetAll().OrderBy(x => x.Name).ToListAsync());

            return(View(viewModel));
        }
コード例 #7
0
        public async Task <IActionResult> GetAllSkills([FromQuery] PaginationFilter filter)
        {
            var route        = Request.Path.Value;
            var validFilter  = new PaginationFilter(filter.PageNumber, filter.PageSize);
            var skillsResult = await _skillService.GetAll(validFilter);

            var pagedReponse = PaginationHelper.CreatePagedReponse(skillsResult.Skills.ToList(), validFilter, skillsResult.TotalRecords, _uriService, route);

            return(Ok(pagedReponse));
        }
コード例 #8
0
        private async Task GetSkills()
        {
            try
            {
                // Get skills from api
                var skills = await _skillService.GetAll();

                if (skills != null)
                {
                    // If skills are found, check if each exists in db
                    foreach (var skill in skills)
                    {
                        var existSkill = await _skillRepository.GetSkillRef(skill.Id);

                        if (existSkill != null)
                        {
                            // If skill exists, update if required
                            if (skill.Name == existSkill.Name && skill.XpCost == existSkill.XpCost)
                            {
                                continue;
                            }
                            else
                            {
                                var updSkill = new Skill
                                {
                                    Name     = skill.Name,
                                    XpCost   = skill.XpCost,
                                    SkillRef = skill.Id,
                                    Id       = existSkill.Id
                                };
                                _skillRepository.UpdateSkill(updSkill);
                            }
                        }
                        else
                        {
                            // If skill doesn't exist, create new
                            var newSkill = new Skill
                            {
                                SkillRef = skill.Id,
                                Name     = skill.Name,
                                XpCost   = skill.XpCost,
                                Id       = skill.Id
                            };
                            _skillRepository.InsertSkill(newSkill);
                        }
                    }

                    await _skillRepository.Save();
                }
            }
            catch (BrokenCircuitException)
            {
                _logger.LogWarning("Broken Circuit");
            }
        }
コード例 #9
0
        public ActionResult <IEnumerable <Skill> > GetSkills()
        {
            var getResult = _skillService.GetAll();

            if (getResult.Success)
            {
                return(getResult.Data);
            }

            return(NotFound());
        }
コード例 #10
0
ファイル: SkillController.cs プロジェクト: camilaleal/Skill
 public ActionResult <IEnumerable <Skill> > Get()
 {
     try
     {
         var result = _skillService.GetAll();
         return(Ok(result));
     }
     catch (Exception ex)
     {
         return(UnprocessableEntity(ex));
     }
 }
コード例 #11
0
        public async Task <IActionResult> Index()
        {
            var skills = await _skillService.GetAll();

            if (skills.ResultStatus == ResultStatus.Success)
            {
                return(View(skills.Data));
            }
            if (skills.ResultStatus == ResultStatus.Error)
            {
                return(NotFound());
            }
            return(View());
        }
コード例 #12
0
        public ActionResult <List <SkillDto> > GetAll()
        {
            try
            {
                var skills = _service.GetAll().ToList();

                List <SkillDto> skillsDto = _mapper.Map <List <SkillDto> >(skills);

                return(Ok(skillsDto));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
コード例 #13
0
        public ActionResult Skills(int categoryId   = 0,
                                   int page         = 1,
                                   int itemsPerPage = 10)
        {
            var viewModel = new SkillsViewModel
            {
                Skills = _skillService.GetAll(categoryId)
                         .ToPagedList(page, itemsPerPage),

                Categories           = _categoryService.GetAll(),
                SelectedCategoryId   = categoryId,
                SelectedCategoryName = categoryId == 0
                                        ? "Filter By Category"
                                        : _categoryService.GetById(categoryId)
                                       .Name
            };

            return(View(viewModel));
        }
コード例 #14
0
        private void Setup(MajorType major)
        {
            var url = HttpContext.Request.GetDisplayUrl();

            IsLocal   = url.Contains("localhost");
            RootPath  = url.Remove(url.IndexOf("shared"));
            Abilities = _abilityService.GetAll <AbilityDescriptionModel>(major).ToList();
            Races     = _raceService.GetAll(major).ToList();
            Branches  = _branchService.GetAllWithPerks(major);
            Traits    = _traitService.GetAll(major).ToList();
            Skills    = _skillService.GetAll(major).ToList();
            if (major != MajorType.Fantasy)
            {
                return;
            }

            MagicSchools = _magicService.GetAllSchools().ToList();
            Alchemy      = _alchemyService.GetSummary();
        }
コード例 #15
0
ファイル: SkillList.cs プロジェクト: ArSIlham/Freelancers
            public async Task <BaseResponses <IEnumerable <Skill> > > Handle(SkillListRequest request, CancellationToken cancellationToken)
            {
                BaseResponses <IEnumerable <Skill> > response = null;



                using (var trx = unitOfWork.BeginTransaction())
                {
                    try
                    {
                        var result = await skillService.GetAll();

                        response = new BaseResponses <IEnumerable <Skill> >(result);
                    }
                    catch (RestException ex)
                    {
                        response = new BaseResponses <IEnumerable <Skill> >(ex.StatusCode, ex.Message);
                    }
                    return(response);
                }
            }
コード例 #16
0
        public PartialViewResult OnGetGrid(MajorType major)
        {
            var list = _skillService.GetAll(major).OrderBy(x => x.Id);

            return(Partial(SitePages.MajorEditorSkills_Grid, list));
        }
コード例 #17
0
 public async Task <IActionResult> Get()
 {
     return(Response(await _service.GetAll()));
 }
コード例 #18
0
 public virtual ActionResult <IEnumerable <SkillDto> > GetAll()
 {
     return(_skillService.GetAll().ToList());
 }
コード例 #19
0
 // GET: Employee/Create
 public ActionResult Create()
 {
     ViewBag.skillList = new MultiSelectList(_skillService.GetAll(), "Id", "SkillName");
     return(View());
 }
コード例 #20
0
 public void GetAll()
 {
     Assert.IsTrue(_skillService.GetAll().ToList().Count == 3);
     Assert.AreEqual(_skillService.GetAll().ToList()[0].Name, "Nokia Lumia 630");
     Assert.AreEqual(_skillService.GetByIdAsync(1).Result.Name, "Nokia Lumia 630");
 }
コード例 #21
0
ファイル: SkillController.cs プロジェクト: GaboAlex/CodiJob
 public IList <SkillDTO> Get()
 {
     return(Service.GetAll());
 }
コード例 #22
0
        //
        // GET: /Skill/

        public ActionResult Skills()
        {
            var model = service.GetAll().Select(e => new { e.Id, e.Name, e.Description }).ToList();

            return(View(model));
        }
コード例 #23
0
 public IEnumerable <SkillDto> GetSkillsByCategory(int id)
 => _skillService.GetAll(id);