Esempio n. 1
0
        public void UpdatePost(UpdatePosts entity)
        {
            Posts postToUpdate = this._DbContext.Posts.Find(entity.PostId);

            postToUpdate.PostContent = entity.PostContent;
            this._DbContext.SaveChanges();
        }
Esempio n. 2
0
 public void UpdatePost([FromBody] UpdatePosts data)
 {
     try
     {
         _unitOfWork.PostsRepository.UpdatePost(data);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 3
0
        public IActionResult Edit(int id, [Bind("PostId,Title,PostContent")] UpdatePosts post)
        {
            if (id != post.PostId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                _unitOfWork.PostsRepository.UpdatePost(post);
                return(RedirectToAction(nameof(Index)));
            }

            return(View(post));
        }