// GET: Activity public async Task <ActionResult> Index() { var user = await _runnerRepository.GetRunner(_userManager.GetUserName(User)); var list = await _activityRepository.GetTrainings(user.IdRunner); return(View(list)); }
public async Task <IActionResult> CreateTraining(ActivityViewModel avm) //passo l'oggetto dentro la viem model { var user = await _runnerRepository.GetRunner(_userManager.GetUserName(User)); Activity a = new Activity //creo un nuovo oggetto activity { ActivityName = avm.ActivityName, Location = avm.Location, CreationDate = DateTime.Now, Status = 0, //0= To be started, 1=in progress, 2=Closed ActivityType = 1, //1=training, 2=gara UriGara = "", Runner_Id = user.IdRunner }; await _activityRepository.InsertActivity(a); return(RedirectToAction("Index", "Activity")); }