public async Task <Pusheen> Delete(Pusheen pusheen)
        {
            _context.Pusheens.Remove(pusheen);
            await _context.SaveChangesAsync();

            return(pusheen);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,FavouriteFood,SuperPower")] Pusheen pusheen)
        {
            if (id != pusheen.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _pusheenService.Update(pusheen);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!_pusheenService.PusheenExists(pusheen.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pusheen));
        }
        public async Task <Pusheen> Update(Pusheen pusheen)
        {
            _context.Update(pusheen);
            await _context.SaveChangesAsync();

            return(pusheen);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,Name,FavouriteFood,SuperPower")] Pusheen pusheen)
        {
            if (ModelState.IsValid)
            {
                await _pusheenService.Create(pusheen);

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