Exemplo n.º 1
0
        public IActionResult Index()
        {
            TestViewModel            model    = new TestViewModel();
            List <TestListViewModel> testList = new List <TestListViewModel>();

            using (var repository = new WebApiClientRepository <List <TestListViewModel> >())
            {
                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/GetTestListByCoach?id=" + userID);
                if (payload != null)
                {
                    testList = payload.ToList();
                }
            }
            model.TestList = testList;
            var testTypeList = GetTestType();

            ViewBag.TestTypeID = new SelectList(testTypeList, "ID", "Name");
            return(View(model));
        }
Exemplo n.º 2
0
        private List <DropDownViewModel> GetTestType()
        {
            List <DropDownViewModel> typeList = new List <DropDownViewModel>();

            using (var repository = new WebApiClientRepository <List <DropDownViewModel> >())
            {
                var payload = repository.GlobalApiCallGet(null, "api/Test/GetTestTypes");
                if (payload != null)
                {
                    typeList = payload.ToList();
                }
            }
            return(typeList);
        }
Exemplo n.º 3
0
        public IActionResult Details(long?id)
        {
            TestAthleteViewModel model = new TestAthleteViewModel();

            using (var repository = new WebApiClientRepository <TestAthleteViewModel>())
            {
                var payload = repository.GlobalApiCallGet(null, "api/Test/GetAthleteListByTestID?id=" + id);
                if (payload != null)
                {
                    model = payload;
                }
            }
            ViewBag.AthleteID = new SelectList(GetAthlete(), "ID", "Name");
            return(View(model));
        }
Exemplo n.º 4
0
        private List <DropDownViewModel> GetAthlete()
        {
            List <DropDownViewModel> athleteList = new List <DropDownViewModel>();

            using (var repository = new WebApiClientRepository <List <DropDownViewModel> >())
            {
                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/GetAllAthletesByCoachID?id=" + userID);
                if (payload != null)
                {
                    athleteList = payload.ToList();
                }
            }
            return(athleteList);
        }
Exemplo n.º 5
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));
        }