Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] PurchaseCategory purchaseCategory)
        {
            if (id != purchaseCategory.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(purchaseCategory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PurchaseCategoryExists(purchaseCategory.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(purchaseCategory));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,FullName,ValidThru,Balance,Group")] PaySource paySource)
        {
            if (id != paySource.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(paySource);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaySourceExists(paySource.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(paySource));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,TimeStamp,Sum,Purchase,PaySourceID,CategoryID")] Expense expense)
        {
            if (id != expense.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    Helpers.Money.CheckExpenseSumAndAjustPaySource(_context, expense);
                    _context.Update(expense);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExpenseExists(expense.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            PopulateCategoryDropDownList();
            PopulatePaySourceDropDownList();
            return(View(expense));
        }
Exemple #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,TimeStamp,Sum,Income,MonthlyIncome,PaySourceID")] Inpayment inpayment)
        {
            if (id != inpayment.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    Helpers.Money.CheckInpaymentSumAndAjustPaySource(_context, inpayment);
                    _context.Update(inpayment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InpaymentExists(inpayment.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PaySourceID"] = new SelectList(_context.PaySources, "ID", "ID", inpayment.PaySourceID);
            PopulateCategoryDropDownList();
            PopulatePaySourceDropDownList();
            return(View(inpayment));
        }