コード例 #1
0
        public async Task <IActionResult> Create([Bind("ID,Name")] PurchaseCategory purchaseCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(purchaseCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(purchaseCategory));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("ID,Name,FullName,ValidThru,Balance,Group")] PaySource paySource)
        {
            if (ModelState.IsValid)
            {
                _context.Add(paySource);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(paySource));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("ID,TimeStamp,Sum,Purchase,PaySourceID,CategoryID")] Expense expense)
        {
            if (ModelState.IsValid)
            {
                _context.Add(expense);
                Helpers.Money.Spend(_context, expense);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            PopulateCategoryDropDownList();
            PopulatePaySourceDropDownList();
            return(View(expense));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("ID,TimeStamp,Sum,Income,MonthlyIncome,PaySourceID")] Inpayment inpayment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(inpayment);
                Helpers.Money.Earn(_context, inpayment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PaySourceID"] = new SelectList(_context.PaySources, "ID", "ID", inpayment.PaySourceID);
            PopulateCategoryDropDownList();
            PopulatePaySourceDropDownList();
            return(View(inpayment));
        }