public ActionResult Delete(int entryID) { EFLedgerEntries ledgerEntries = new EFLedgerEntries(); IQueryable<LedgerEntry> list = Entries.GetEntries; LedgerEntry entry = list.Select(e => e) .Where(e => e.LedgerEntryID == entryID) .First(); ledgerEntries.Delete(entry); return RedirectToAction("List"); }
public ActionResult Edit(LedgerEntry entry, bool add = false) { EFLedgerEntries ledgerEntries = new EFLedgerEntries(); if (ModelState.IsValid) { if (!add) ledgerEntries.Edit(entry); else ledgerEntries.Add(entry); return RedirectToAction("List"); } else { ViewBag.Add = add; return View(); } }