public ActionResult Problem(int problemId) { List <NewSubmission> submissions = new List <NewSubmission>(); for (int i = 0; i < db.Submissions.ToList().Count; ++i) { if (db.Submissions.ToList()[i].SubmissionProblemId == problemId) { NewSubmission submission = new NewSubmission(db.Submissions.ToList()[i]); for (int j = 0; j < db.Users.ToList().Count; ++i) { if (db.Users.ToList()[j].Id == submission.SubmissionAccountId) { submission.UserName = db.Users.ToList()[j].UserName; break; } } submissions.Add(submission); } } return(View(submissions)); }
public ActionResult View(int submissionId) { for (int i = 0; i < db.Submissions.ToList().Count; ++i) { if (db.Submissions.ToList()[i].Id == submissionId) { NewSubmission submission = new NewSubmission(db.Submissions.ToList()[i]); for (int j = 0; j < db.Users.ToList().Count; ++i) { if (db.Users.ToList()[j].Id == submission.SubmissionAccountId) { submission.UserName = db.Users.ToList()[j].UserName; return(View(submission)); } } break; } } return(View()); }