예제 #1
0
 public ActionResult Create()
 {
     Account account = new Account();
     ViewBag.PossibleAccountCategories = accountcategoryRepository.All;
     ViewBag.PossibleParentAccounts = accountRepository.All;
     return View(account);
 }
예제 #2
0
 public ActionResult Create(Account account)
 {
     if (ModelState.IsValid) {
         accountRepository.InsertOrUpdate(account);
         accountRepository.Save();
         return RedirectToAction("Index");
     } else {
         ViewBag.PossibleAccountCategories = accountcategoryRepository.All;
         ViewBag.PossibleParentAccounts = accountRepository.All;
         return View(account);
     }
 }
예제 #3
0
 public void InsertOrUpdate(Account account)
 {
     if (account.AccountID == default(int)) {
         // New entity
         context.Account.Add(account);
     } else {
         // Existing entity
         context.Entry(account).State = EntityState.Modified;
     }
 }
예제 #4
0
 public ViewResult Search(Account searchAccount)
 {
     if(searchAccount!=null)
     {
                     }
                 return View("Index",accountRepository.AllIncluding(account => account.AccountCategory, account => account.ParentAccount));
 }