示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] CreditEntities creditEntities)
        {
            if (id != creditEntities.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(creditEntities);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CreditEntitiesExists(creditEntities.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(creditEntities));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Name")] CreditEntities creditEntities)
        {
            if (ModelState.IsValid)
            {
                _context.Add(creditEntities);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(creditEntities));
        }