Example #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,name,author,dateCompleted")] Book book)
        {
            if (id != book.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(book);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookExists(book.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Author,Genre,Pages,ReleaseDate,FinishedReading")] Book book)
        {
            if (id != book.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(book);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookExists(book.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
Example #3
0
        public async Task Update(Book book)
        {
            _context.Update(book);

            await _context.SaveChangesAsync();
        }
Example #4
0
 public async Task Update(Autor author)
 {
     _context.Update(author);
     await _context.SaveChangesAsync();
 }
Example #5
0
        public async Task Update(Purchase purchase)
        {
            _context.Update(purchase);

            await _context.SaveChangesAsync();
        }