public void Delete(asnwers entity) { Repository.Delete(entity); }
public void Add(asnwers entity) { Repository.Add(entity); }
/// <summary> /// Deprecated Method for adding a new object to the asnwers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToasnwers(asnwers asnwers) { base.AddObject("asnwers", asnwers); }
/// <summary> /// Create a new asnwers object. /// </summary> /// <param name="asnwerID">Initial value of the AsnwerID property.</param> /// <param name="lecturerID">Initial value of the LecturerID property.</param> public static asnwers Createasnwers(global::System.Int32 asnwerID, global::System.Int32 lecturerID) { asnwers asnwers = new asnwers(); asnwers.AsnwerID = asnwerID; asnwers.LecturerID = lecturerID; return asnwers; }
public ActionResult Edit(questions questions, FormCollection collection) { var answerContent = collection["AnswerContent"]; if (ModelState.IsValid) { //create new answer asnwers answer = new asnwers(); answer.CreatedDate = DateTime.UtcNow; answer.Content = answerContent; answer.LecturerID = context.lecturers.Single(x => x.UserName == User.Identity.Name).LecturerID; context.asnwers.AddObject(answer); context.SaveChanges(); questions.AnswerID = answer.AsnwerID; context.questions.Attach(questions); //questions _question = context.questions.Single(x => x.QuestionID == questions.QuestionID); context.ObjectStateManager.ChangeObjectState(questions, EntityState.Modified); context.SaveChanges(); return RedirectToAction("Index"); } return View(questions); }