public ActionResult DeleteConfirmed(long id) { QuestionsPost questions = _questionsService.GetPost(id); questions.UserName = User.Identity.Name; _questionsService.Delete(questions); return(RedirectToAction("Index")); }
public ActionResult Edit(long id) { QuestionsPost questions = _questionsService.GetPost(id); if (questions == null) { return(NotFound()); } ViewBag.ixLanguage = new SelectList(_questionsService.selectLanguageStyles().Select(x => new { x.ixLanguageStyle, x.sLanguageStyle }), "ixLanguageStyle", "sLanguageStyle", questions.ixLanguage); ViewBag.ixLanguageStyle = new SelectList(_questionsService.selectLanguageStyles().Select(x => new { x.ixLanguageStyle, x.sLanguageStyle }), "ixLanguageStyle", "sLanguageStyle", questions.ixLanguageStyle); ViewBag.ixResponseType = new SelectList(_questionsService.selectResponseTypes().Select(x => new { x.ixResponseType, x.sResponseType }), "ixResponseType", "sResponseType", questions.ixResponseType); ViewBag.ixTopic = new SelectList(_questionsService.selectTopics().Select(x => new { x.ixTopic, x.sTopic }), "ixTopic", "sTopic", questions.ixTopic); return(View(questions)); }
public ActionResult Edit([Bind("ixQuestion,sQuestion,ixLanguage,ixLanguageStyle,ixTopic,sAsk,sAnswer,ixResponseType,bActive")] QuestionsPost questions) { if (ModelState.IsValid) { questions.UserName = User.Identity.Name; _questionsService.Edit(questions); return(RedirectToAction("Index")); } ViewBag.ixLanguage = new SelectList(_questionsService.selectLanguageStyles().Select(x => new { x.ixLanguageStyle, x.sLanguageStyle }), "ixLanguageStyle", "sLanguageStyle", questions.ixLanguage); ViewBag.ixLanguageStyle = new SelectList(_questionsService.selectLanguageStyles().Select(x => new { x.ixLanguageStyle, x.sLanguageStyle }), "ixLanguageStyle", "sLanguageStyle", questions.ixLanguageStyle); ViewBag.ixResponseType = new SelectList(_questionsService.selectResponseTypes().Select(x => new { x.ixResponseType, x.sResponseType }), "ixResponseType", "sResponseType", questions.ixResponseType); ViewBag.ixTopic = new SelectList(_questionsService.selectTopics().Select(x => new { x.ixTopic, x.sTopic }), "ixTopic", "sTopic", questions.ixTopic); return(View(questions)); }
public Task Delete(QuestionsPost questionsPost) { // Additional validations // Pre-process // Process this._questionsRepository.RegisterDelete(questionsPost); try { this._questionsRepository.Commit(); } catch (Exception ex) { this._questionsRepository.Rollback(); // Log exception throw; } // Post-process return(Task.CompletedTask); }
public Task <Int64> Create(QuestionsPost questionsPost) { // Additional validations // Pre-process // Process this._questionsRepository.RegisterCreate(questionsPost); try { this._questionsRepository.Commit(); } catch (Exception ex) { this._questionsRepository.Rollback(); // Log exception throw; } // Post-process return(Task.FromResult(questionsPost.ixQuestion)); }
public void RegisterDelete(QuestionsPost questionsPost) { _context.QuestionsPost.Remove(questionsPost); }
public void RegisterEdit(QuestionsPost questionsPost) { _context.Entry(questionsPost).State = EntityState.Modified; }
public void RegisterCreate(QuestionsPost questionsPost) { _context.QuestionsPost.Add(questionsPost); }