public ActionResult Index(QuestionCoding model) { if (model.AuthorStudentId > 0) { return(RedirectToAction("GetNextQuestion", new { studentId = model.AuthorStudentId })); } else { return(View()); } }
public ActionResult GetNextQuestion(GetNextQuestionViewModel vm) { //add coding QuestionCoding coding = new QuestionCoding() { AuthorStudentId = vm.StudentId, PostId = vm.Post.Id, IsQuestion = vm.IsQuestion, }; Db.QuestionCodings.Add(coding); //update response count QuestionResponseCount count = Db.QuestionResponseCounts.Where(c => c.ContentId == vm.Post.Id).FirstOrDefault(); count.Count++; Db.Entry(count).State = System.Data.Entity.EntityState.Modified; Db.SaveChanges(); return(RedirectToAction("GetNextQuestion", new { studentId = vm.StudentId })); }