Exemplo n.º 1
0
        public async Task <IActionResult> PutAccountB([FromRoute] int id, [FromBody] AccountB accountB)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != accountB.Id)
            {
                return(BadRequest());
            }

            _context.Entry(accountB).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AccountBExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,AccountNo,WithdrawalDate")] AccountB accountB)
        {
            if (ModelState.IsValid)
            {
                _context.Add(accountB);
                await _context.SaveChangesAsync();

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