public ActionResult DeleteSurvey(long id, FormCollection collection) { try { SurveyFactory DeleteSurvey = new SurveyFactory(); SurveyEntity Survey = new SurveyEntity(); Survey = DeleteSurvey.GetSurveyById(id); DataLayer.tblSurvey NewSurvey = new DataLayer.tblSurvey(); NewSurvey.SurveyId = id; NewSurvey.AnsTypeId = Survey.AnsTypeId; NewSurvey.SurveyName = Survey.SurveyName; NewSurvey.SurveyDescription = Survey.SurveyDescription; NewSurvey.CompletionText = Survey.CompletionText; NewSurvey.IsNeverExpire = Survey.IsNeverExpire; NewSurvey.ExpiryDate = Survey.ExpiryDate; NewSurvey.CreatedDate = Survey.CreatedDate; NewSurvey.CreatedBy = Survey.CreatedBy; NewSurvey.UpdatedDate = DateTime.Now; NewSurvey.UpdatedBy = null; NewSurvey.IsActive = false; // IsActive will be false in delete record DeleteSurvey.SaveSurvey(NewSurvey); return(RedirectToAction("Survey")); } catch { return(View()); } }
// GET: Survey/Delete/5 public ActionResult DeleteSurvey(long id) { SurveyFactory EditSurvey = new SurveyFactory(); SurveyEntity topic = new SurveyEntity(); topic = EditSurvey.GetSurveyById(id); return(View(topic)); }
// GET: Survey/Edit/5 public ActionResult EditSurvey(long id) { try { SurveyFactory EditSurvey = new SurveyFactory(); SurveyEntity topic = new SurveyEntity(); topic = EditSurvey.GetSurveyById(id); return(View(topic)); } catch { return(View()); } finally { GetSurveyAnswerType(); } }