コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Code,Name,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] Currency currency)
        {
            if (ModelState.IsValid)
            {
                _context.Add(currency);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(currency));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Code,Name,TypeId,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] AccountCategory accountCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(accountCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TypeId"] = new SelectList(_context.AccountTypes, "Id", "Code", accountCategory.TypeId);
            return(View(accountCategory));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Code,Name,Active,Checking,BankName,BankAddress,BankAccountNumber,BankAccountHolder,CategoryId,ParentId")] Account account)
        {
            if (ModelState.IsValid)
            {
                _context.Add(account);
                await _context.SaveChangesAsync();

                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));
        }