Пример #1
0
        public ActionResult <AthleteTestViewModel> GetTestListByAthlete(long id)
        {
            AthleteTestViewModel model = new AthleteTestViewModel();

            model = _repo.TestCustomRepository.GetAllTestByAthleteID(id);
            return(Ok(model));
        }
Пример #2
0
        internal AthleteTestViewModel GetAllTestByAthleteID(long id)
        {
            AthleteTestViewModel            item     = new AthleteTestViewModel();
            List <AthleteTestListViewModel> testList = _context.TestAthlete.Where(t => t.AthleteID == id && !t.IsRemoved).Select(a =>
                                                                                                                                 new AthleteTestListViewModel
            {
                ID            = a.ID,
                TestDate      = a.Test.TestDate,
                FitnessRating = a.FitnessRating.Name,
                TestName      = a.Test.TestType.Name,
                TestValue     = a.TestValue
            }).ToList();

            item.TestList  = testList.OrderByDescending(t => t.TestDate).ToList();
            item.TotalTest = testList.Count;
            return(item);
        }
Пример #3
0
        public IActionResult Index()
        {
            AthleteTestViewModel model = new AthleteTestViewModel();

            using (var repository = new WebApiClientRepository <AthleteTestViewModel>())
            {
                int userID = 0;
                using (var storage = new LocalStorage())
                {
                    LoggedInUserInfo userInfo = JsonConvert.DeserializeObject <LoggedInUserInfo>(storage.Get("userInfo").ToString());
                    userID = userInfo.UserID;
                }
                var payload = repository.GlobalApiCallGet(null, "api/Test/GetTestListByAthlete?id=" + userID);
                if (payload != null)
                {
                    model = payload;
                    return(View(model));
                }
            }
            return(View(model));
        }