示例#1
0
        public async Task <IActionResult> EditPost(EditePostViewModel model)
        {
            if (ModelState.IsValid)
            {
                Publication post = _publication.GetPostDB(model.Id);
                if (post != null)
                {
                    post.PublicationName = model.PublicationName;
                    post.PublicationText = model.PublicationText;
                    post.Discription     = model.Discription;
                    post.TopicId         = _topic.GetTopicDB(model.TopicName).Id;
                    post.Topic           = _topic.GetTopicDB(model.TopicName);

                    _publication.UpdatePost(post);

                    return(RedirectToAction("AllPosts"));
                }
            }
            return(View(model));
        }
示例#2
0
 public void UpdatePost(Publication post) => _publication.UpdatePost(post);