public async Task <IActionResult> Edit(int id, [Bind("BookName,Picture,Path,Datetime,ID,Author")] EBook eBook)
        {
            if (id != eBook.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(eBook);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EBookExists(eBook.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(eBook));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,TagId,ArticleId,AuthorId")] ArticleTag articleTag)
        {
            if (id != articleTag.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(articleTag);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ArticleTagExists(articleTag.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArticleId"] = new SelectList(_context.Articles, "Id", "SefName", articleTag.ArticleId);
            ViewData["AuthorId"]  = new SelectList(_context.Users, "Id", "Id", articleTag.AuthorId);
            ViewData["TagId"]     = new SelectList(_context.Tags, "Id", "Name", articleTag.TagId);
            return(View(articleTag));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,ActivityDate,Operation,Information,AuthorId")] Activity activity)
        {
            if (id != activity.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(activity);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ActivityExists(activity.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AuthorId"] = new SelectList(_context.Users, "Id", "Id", activity.AuthorId);
            return(View(activity));
        }