Exemple #1
0
        public async Task <IActionResult> Create([Bind("ExpenseID,ExpenseType,ExpenseAmount,ExpenseChequeNumber,ExpenseBankName,ExpenseParticular,ExpenseDate,ExMonth,ExYear,ExpApprove,Totalexpense,Profit")] Expense expense)
        {
            if (ModelState.IsValid)
            {
                int i = SaveExpenseDataBase(expense);
                if (i > 0)
                {
                    ViewBag.Message = "Save Successfully To The Expense Table !!!";
                    int vdSave = SaveViewClassForDetailsExpenseTable(expense, expense.ExpenseAmount, expense.ExMonth, expense.ExYear);
                    if (vdSave > 0)
                    {
                        ViewBag.Message = "Save Successfully to The SaveViewClassForDetailsTable !!!";
                    }
                    else
                    {
                        ViewBag.Message = "Not Save to The SaveViewClassForDetailsTable!!!";
                    }
                }
                else
                {
                    ViewBag.Message = "Not Save!!!";
                }
                _context.Add(expense);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(PendingExpense)));
            }
            return(View(expense));
        }