Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Link,ImageLink")] Bookies bookies)
        {
            if (id != bookies.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bookies);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookiesExists(bookies.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bookies));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Link,ImageLink")] Bookies bookies)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bookies);
                await _context.SaveChangesAsync();

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