示例#1
0
        public void AddNewReply(DetailsReplyBindingModel bind, User user)
        {
            Topic topic = this.Context.Topics.FirstOrDefault(t => t.Title == bind.TopicTitle);

            this.Context.Replies.Add(new Reply()
            {
                PublishedDate = DateTime.Now,
                ImageUrl      = bind.imageUrl,
                Author        = user,
                Content       = bind.Content,
                Topic         = topic
            });
            this.Context.SaveChanges();
        }
示例#2
0
        public void Details(HttpRequest request, HttpSession session, HttpResponse response, DetailsReplyBindingModel bind)
        {
            User user = AuthenticatedManager.GetAuthenticatedUser(session.Id);

            if (user == null)
            {
                this.Redirect(response, "/home/topics");
                return;
            }

            this.service.AddNewReply(bind, user);
            this.Redirect(response, request.Url);
        }