Exemplo n.º 1
0
        private void DoWork(object state)
        {
            logger.LogInformation("Award Background Service is working.");

            var awards = awardService.GetAll();
            var year   = awards.Max(x => x.Year);

            year++;

            awardService.Update(new Domain.Award {
                Name = $"Grammy of {year}",
                Role = "Mister X",
                Show = $"Undergound Show of {year}",
                Year = year
            });
        }
Exemplo n.º 2
0
        public JsonList <AwardModel> GetAll(
            [FromUri] AwardSearchCriteria searchCriteria,
            [FromUri] PaginationOptions options)
        {
            options = GetPaginationOptions(options);

            var model = new JsonList <AwardModel>();

            if (searchCriteria.NoPaging)
            {
                var allAwards = _awardService.GetAll();
                model.Data       = allAwards.ToModelList <Award, AwardModel>();
                model.TotalItems = allAwards.Count;
            }
            else
            {
                var searchData = _awardService.Search(searchCriteria, options, _workContext.User);
                model.Data       = searchData.ToModelList <Award, AwardModel>();
                model.TotalItems = searchData.TotalCount;
            }
            return(model);
        }
 public List <AwardViewModel> GetAwards()
 {
     return(Mapper.Map <List <AwardViewModel> >(_awardService.GetAll()));
 }
Exemplo n.º 4
0
 public IActionResult GetData()
 {
     return(Json(new { data = awardService.GetAll() }));
 }