Exemple #1
0
        public IActionResult List()
        {
            //fetching all stages
            List <StagesListVM> Model = _repo.GetAll().Select(s => new StagesListVM
            {
                StageID  = s.ID,
                Name     = s.Name,
                Capacity = s.Capacity,
                Sponsor  = s.Sponsor.CompanyName
            }).ToList();

            //ordered list
            int broj = 0;

            foreach (StagesListVM x in Model)
            {
                x.Number = ++broj;
            }
            return(View(Model));
        }
Exemple #2
0
        public IEnumerable <StageDto> GetAll()
        {
            try
            {
                var stages = _repository.GetAll();

                if (stages == null)
                {
                    _logger.LogError($"stages with EventDate id: , hasn't been found in db.");
                    return(null);
                }

                _logger.LogInfo($"Returned stages with EventDate id:");

                var Result = _mapper.Map <IEnumerable <StageDto> >(stages);
                return(Result);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Something went wrong inside GetStageByEventDate action: {ex.Message}");
                throw new Exception();
            }
        }
Exemple #3
0
        // GET: api/Stage
        public IHttpActionResult GetAll()
        {
            var stages = _stageRepository.GetAll();

            return(Ok(stages));
        }