Пример #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);
        }
        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");
            }
        }
        public ActionResult <IEnumerable <Skill> > GetSkills()
        {
            var getResult = _skillService.GetAll();

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

            return(NotFound());
        }
Пример #10
0
 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
            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());
 }
 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
 public IList <SkillDTO> Get()
 {
     return(Service.GetAll());
 }
        //
        // 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);