Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Login")] UserViewModel user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                _operation.Update(user);
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] TagViewModel tags)
        {
            if (id != tags.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                _operation.Update(tags);
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tags));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Contents,UserId,PostId")]
                                               CommentViewModel comments)
        {
            if (id != comments.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                _operation.Update(comments);
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PostId"] = GetPosts(comments.PostId);
            ViewData["UserId"] = GetUsers(comments.UserId);
            return(View(comments));
        }