Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Name,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] Currency currency)
        {
            if (id != currency.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(currency);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CurrencyExists(currency.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(currency));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Name,TypeId,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] AccountCategory accountCategory)
        {
            if (id != accountCategory.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accountCategory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccountCategoryExists(accountCategory.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TypeId"] = new SelectList(_context.AccountTypes, "Id", "Code", accountCategory.TypeId);
            return(View(accountCategory));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Name,Active,Checking,BankName,BankAddress,BankAccountNumber,BankAccountHolder,CategoryId,ParentId")] Account account)
        {
            if (id != account.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(account);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccountExists(account.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.AccountCategories, "Id", "Code", account.CategoryId);
            ViewData["ParentId"]   = new SelectList(_context.Accounts, "Id", "Code", account.ParentId);
            return(View(account));
        }