partial void UpdateResponse(Response instance);
partial void DeleteResponse(Response instance);
partial void InsertResponse(Response instance);
private void detach_Responses(Response entity) { this.SendPropertyChanging(); entity.Question = null; }
private void attach_Responses(Response entity) { this.SendPropertyChanging(); entity.Answer = this; }
private void detach_Responses(Response entity) { this.SendPropertyChanging(); entity.aspnet_User = null; }
public virtual ActionResult Index(SubmitViewModel model) { ViewBag.curPage = "Home"; if (!ModelState.IsValid) { return View(model); } var db = Current.DB; // Just in case, start with blank slate db.Responses.DeleteAllOnSubmit(db.Responses.Where(r => r.UserId == Current.UserID)); db.SubmitChanges(); // Insert responses foreach (var q in model.Questions) { var r = new Response(); r.UserId = Current.UserID.Value; r.QuestionId = q.qID; r.AnswerId = q.SelectedAnswer; r.Date = DateTime.UtcNow; db.Responses.InsertOnSubmit(r); } db.SubmitChanges(); return RedirectToAction("AlreadySubmitted"); }