예제 #1
0
        public async Task <IActionResult> ViewTrainingData(Activity act)
        {
            IEnumerable <Point> list = await _pointRepo.GetActivityPointsAsync(act.Id);

            ViewData["Telemetry"] = list;
            ViewData["Activity"]  = act;
            list.AsList().RemoveAt(0);
            return(View());
        }
예제 #2
0
        public async Task <IActionResult> CreateTraining(ActivityViewModel activity)
        {
            var runner = await _runnerRepo.GetUserAsync(_userManager.GetUserId(User));

            Activity obj = new Activity
            {
                IdRunner = runner.Id,
                Name     = activity.Name,
                Place    = activity.Place,
                Type     = 1, //1= training, 2 = gara
            };
            await _activityRepo.InsertAsync(obj);

            return(RedirectToAction("Index"));
        }
예제 #3
0
        /// <summary>
        /// Registers the current user to a race on SharedRuns and creates the current istance-activity
        /// </summary>
        /// <param name="race">the race to join</param>
        /// <returns></returns>
        public async Task <IActionResult> JoinRace(Race race)
        {
            var runner = await _runnerRepo.GetUserAsync(_userManager.GetUserId(User));

            await _sharedRunService.JoinRace(race.UriGara, runner.Id);

            Activity personalRace = new Activity
            {
                IdRunner     = runner.Id,
                Name         = race.Name,
                Place        = race.Place,
                UriGara      = race.UriGara,
                Type         = 2,
                CreationDate = DateTime.Now,
                Status       = 0
            };

            await _activityRepo.InsertAsync(personalRace);

            return(RedirectToAction("Index"));
        }
예제 #4
0
 public IActionResult StartTraining(Activity activity)
 {
     return(View(activity));
 }