예제 #1
0
 public void CreateTest()
 {
     o = CommentObjectFactory.Create(id, commentAddTime, commentText,
                                     subject, email);
     validateResults(id, commentAddTime, commentText,
                     subject, email);
 }
예제 #2
0
        public async Task <IActionResult> CreateNewComment(string commentText, string id, string subject, string email)
        {
            // COMMENT
            var    commentId     = GetUniqueID();
            string currentUserId = GetCurrentUserID();
            var    o             = CommentObjectFactory.Create(commentId, DateTime.Now, commentText, subject, email);
            await _commentRepository.AddObject(o);


            // COMMENT-EVENT
            var eventObject = await _eventRepository.GetObject(id);

            var commentObject = await _commentRepository.GetObject(commentId);

            var ceo = CommentEventObjectFactory.Create(eventObject, commentObject, id, commentId);
            await _commentEventRepository.AddObject(ceo);

            //COMMENT-PROFILE
            var profileObject = await _profileRepository.GetObject(currentUserId);

            var cpo = CommentProfileObjectFactory.Create(commentObject, profileObject, commentId, currentUserId);
            await _commentProfileRepository.AddObject(cpo);

            return(RedirectToAction(nameof(Details), new { id }));
        }