示例#1
0
        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");
        }
示例#2
0
        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();
            }
        }