Exemple #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Name,Surname,Email,Password,Id")] Member member)
        {
            if (id != member.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(member);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MemberExists(member.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(member));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Title,Author,Edition,Year,Quantity,Id")] 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));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(Guid id, [Bind("IsReturned,RequestedOn,ReturnedOn,MemberId,BookId,Id")] Lend lend)
        {
            if (id != lend.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lend);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LendExists(lend.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"]   = new SelectList(_context.Books, "Id", "Id", lend.BookId);
            ViewData["MemberId"] = new SelectList(_context.Members, "Id", "Id", lend.MemberId);
            return(View(lend));
        }