public ActionResult GetAnswerView(Answers answers) { return PartialView("_GetAnswerView", answers); }
public ActionResult MyAnswers() { var disciplines = db.Disciplines; var myAnswers = db.Answers.Where(a => a.Username == User.Identity.Name); var answers = new List<Answers>(); foreach (var discipline in disciplines) { if (!myAnswers.Any(a => discipline.DisciplineId == a.DisciplineId)) { var answ = new Answers { DisciplineId = discipline.DisciplineId, Discipline = discipline, Username = User.Identity.Name }; db.Answers.Add(answ); db.SaveChanges(); answers.Add(answ); } } //answers.AddRange(myAnswers); return View(db.Answers.Where(a => a.Username == User.Identity.Name).OrderBy(d => d.Discipline.Date)); }