public async Task <ActionResult> TakePart(int contestId) { UserProfile user = await _usersProvider.GetByLogin(HttpContext.User.Identity.Name); Contest contest = await _contestsProvider.GetContest(contestId); Competitor competitor = new Competitor() { Contest = contest, IdContest = contest.ContestId, UserProfile = user, IdProfile = user.Id }; IdentityResult result = await _competitorProvider.AddCompretitor(competitor); if (result.Succeeded) { return(Json(new { Succeeded = result.Succeeded }, JsonRequestBehavior.DenyGet)); } return(RedirectToAction("ContestsHistory")); }