public async Task <IActionResult> Edit(int id, [Bind("CommentId,Name,Star,Image,Job,Explanation")] Comment comment)
        {
            if (id != comment.CommentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommentExists(comment.CommentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(comment));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("BlogId,Title,Date,Image")] Blog blog)
        {
            if (id != blog.BlogId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(blog);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BlogExists(blog.BlogId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(blog));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("DestinationId,Country,Place,Tour,CountryImage,PlaceImage,Price,TourDayCount")] Destination destination)
        {
            if (id != destination.DestinationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(destination);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DestinationExists(destination.DestinationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(destination));
        }