public ActionResult Create(CheatNoteItem cheatNoteItem) { try { using (var db = new CheatNotesContext()) { cheatNoteItem.CreatedById = GetCurrentUserId(); cheatNoteItem.Title = cheatNoteItem.Title.AntiCodeInjection(); cheatNoteItem.Content = cheatNoteItem.Content.AntiCodeInjection(); db.CheatNoteItems.Add(cheatNoteItem); db.SaveChanges(); } return RedirectToItemList(cheatNoteItem.CheatNoteId, cheatNoteItem.Position); //return RedirectToAction("List", new { cnid = cheatNoteItem.CheatNoteId }); } catch { return View(); } }
public TaggedCheatNoteItem(CheatNoteItem item, int? partNo) { Item = item; PartNo = partNo; }
public ActionResult Delete(int id, CheatNoteItem cheatNoteItem) { return SetInstanceDeleted(id, cheatNoteItem); }
private ActionResult SetInstanceDeleted(int id, CheatNoteItem cheatNoteItem, bool isDeleted = true) { try { SetInstanceDeleted(db => db.CheatNoteItems, id, isDeleted); return RedirectToItemList(cheatNoteItem.CheatNoteId, cheatNoteItem.Position); //return RedirectToAction("List", new { cnid = cheatNoteItem.CheatNoteId }); } catch { return RedirectToItemList(cheatNoteItem.CheatNoteId, cheatNoteItem.Position); //return RedirectToAction("List", new { cnid = cheatNoteItem.CheatNoteId }); } }
private ActionResult Save(int id, CheatNoteItem cheatNoteItem, int? nextItemId) { try { using (var db = new CheatNotesContext()) { var instance = db.CheatNoteItems.Get(id); instance.Position = cheatNoteItem.Position; instance.Title = cheatNoteItem.Title.AntiCodeInjection(); instance.Content = cheatNoteItem.Content.AntiCodeInjection(); instance.DateModified = DateTime.Now; instance.ModifiedById = GetCurrentUserId(); db.SaveChanges(); } return nextItemId.HasValue ? RedirectToAction("Edit", new { id = nextItemId.Value }) : RedirectToItemList(cheatNoteItem.CheatNoteId, cheatNoteItem.Position); //return RedirectToAction("List", new { cnid = cheatNoteItem.CheatNoteId }); } catch { return View(); } }
public ActionResult Restore(int id, CheatNoteItem cheatNoteItem) { return SetInstanceDeleted(id, cheatNoteItem, false); }
public ActionResult Next(int id, CheatNoteItem cheatNoteItem, int? nextItemId) { return Save(id, cheatNoteItem, nextItemId); }