public async Task <IActionResult> Create([Bind("AccountName,ID")] Accounts accounts)
        {
            if (ModelState.IsValid)
            {
                accounts.ID = Guid.NewGuid();
                _context.Add(accounts);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(accounts));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Name,ID")] ExpenseCategory expenseCategory)
        {
            if (ModelState.IsValid)
            {
                expenseCategory.ID = Guid.NewGuid();
                _context.Add(expenseCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(expenseCategory));
        }
        public async Task <IActionResult> Create([Bind("PersonName,Amount,Remarks,ID")] LoanInfo loanInfo)
        {
            if (ModelState.IsValid)
            {
                loanInfo.ID = Guid.NewGuid();
                _context.Add(loanInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(loanInfo));
        }
        public async Task <IActionResult> Create([Bind("ExpenseCategoryID,AccountsID,Amount,Date,Remarks,ID")] ExpenseHistory expenseHistory)
        {
            if (ModelState.IsValid)
            {
                expenseHistory.ID = Guid.NewGuid();
                _context.Add(expenseHistory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccountsID"]        = new SelectList(_context.Accounts.OrderBy(x => x.AccountName), "ID", "AccountName", expenseHistory.AccountsID);
            ViewData["ExpenseCategoryID"] = new SelectList(_context.ExpenseCategory.OrderBy(x => x.Name), "ID", "Name", expenseHistory.ExpenseCategoryID);
            return(View(expenseHistory));
        }