コード例 #1
0
        public ViewResult AddSportAttribute(SportAttributesViewModel viewModel)
        {
            ViewBag.Title    = "Sportmateriaal toevoegen";
            viewModel.Sports = _sportAccess.GetSports();

            return(View(viewModel));
        }
コード例 #2
0
        public ViewResult AddEvent()
        {
            ViewBag.Title = "Evenementen toevoegen";

            return(View(new EventSportViewModel {
                Sports = _sportAccess.GetSports()
            }));
        }
コード例 #3
0
 public ViewResult Sport(int page = 1)
 => View(new SportViewModel
 {
     Sports = _sportAccess.GetSports()
              .OrderBy(s => s.Type)
              .Skip((page - 1) * PageSize)
              .Take(PageSize),
     PagingViewModel = new PagingViewModel
     {
         CurrentPage  = page,
         ItemsPerPage = PageSize,
         TotalItems   = _sportAccess.GetSports().Count()
     }
 });
コード例 #4
0
        public IActionResult Get()
        {
            var sports   = _sportAccess.GetSports();
            var response = new List <HALResponse>();

            foreach (var sport in sports)
            {
                var resource = new SportResource(sport);
                response.Add(new HALResponse(resource).AddLinks(
                                 new Link("self", "/api/Sport/" + sport.SportId + "", null, "GET")));
            }

            return(Ok(response));
        }