public ActionResult DeleteConfirmed(long id) { GreetingsPost greetings = _greetingsService.GetPost(id); greetings.UserName = User.Identity.Name; _greetingsService.Delete(greetings); return(RedirectToAction("Index")); }
public ActionResult Edit(long id) { GreetingsPost greetings = _greetingsService.GetPost(id); if (greetings == null) { return(NotFound()); } ViewBag.ixLanguage = new SelectList(_greetingsService.selectLanguages().Select(x => new { x.ixLanguage, x.sLanguage }), "ixLanguage", "sLanguage", greetings.ixLanguage); ViewBag.ixLanguageStyle = new SelectList(_greetingsService.selectLanguageStyles().Select(x => new { x.ixLanguageStyle, x.sLanguageStyle }), "ixLanguageStyle", "sLanguageStyle", greetings.ixLanguageStyle); ViewBag.ixResponseType = new SelectList(_greetingsService.selectResponseTypes().Select(x => new { x.ixResponseType, x.sResponseType }), "ixResponseType", "sResponseType", greetings.ixResponseType); return(View(greetings)); }
public ActionResult Edit([Bind("ixGreeting,sGreeting,ixLanguage,ixLanguageStyle,sGreetingOffered,sGreetingResponse,ixResponseType,bActive")] GreetingsPost greetings) { if (ModelState.IsValid) { greetings.UserName = User.Identity.Name; _greetingsService.Edit(greetings); return(RedirectToAction("Index")); } ViewBag.ixLanguage = new SelectList(_greetingsService.selectLanguages().Select(x => new { x.ixLanguage, x.sLanguage }), "ixLanguage", "sLanguage", greetings.ixLanguage); ViewBag.ixLanguageStyle = new SelectList(_greetingsService.selectLanguageStyles().Select(x => new { x.ixLanguageStyle, x.sLanguageStyle }), "ixLanguageStyle", "sLanguageStyle", greetings.ixLanguageStyle); ViewBag.ixResponseType = new SelectList(_greetingsService.selectResponseTypes().Select(x => new { x.ixResponseType, x.sResponseType }), "ixResponseType", "sResponseType", greetings.ixResponseType); return(View(greetings)); }
public Task Delete(GreetingsPost greetingsPost) { // Additional validations // Pre-process // Process this._greetingsRepository.RegisterDelete(greetingsPost); try { this._greetingsRepository.Commit(); } catch (Exception ex) { this._greetingsRepository.Rollback(); // Log exception throw; } // Post-process return(Task.CompletedTask); }
public Task <Int64> Create(GreetingsPost greetingsPost) { // Additional validations // Pre-process // Process this._greetingsRepository.RegisterCreate(greetingsPost); try { this._greetingsRepository.Commit(); } catch (Exception ex) { this._greetingsRepository.Rollback(); // Log exception throw; } // Post-process return(Task.FromResult(greetingsPost.ixGreeting)); }
public void RegisterDelete(GreetingsPost greetingsPost) { _context.GreetingsPost.Remove(greetingsPost); }
public void RegisterEdit(GreetingsPost greetingsPost) { _context.Entry(greetingsPost).State = EntityState.Modified; }
public void RegisterCreate(GreetingsPost greetingsPost) { _context.GreetingsPost.Add(greetingsPost); }