Example #1
0
        public ActionResult PostingForm(int wallId)
        {
            InputPostDto newPost = new InputPostDto();

            newPost.WallId = wallId;
            return(PartialView("PostingForm", newPost));
        }
Example #2
0
 public ActionResult Post(InputPostDto postDto, int wallId)
 {
     postDto.AuthorId = ((UserDto)Session["session"]).Id;
     postDto.WallId   = wallId;
     postService.Post(postDto);
     return(RedirectToAction("Wall", new { wallId = wallId }));
 }
Example #3
0
        public ActionResult PostingForm(int wallId, bool onlyImage)
        {
            InputPostDto newPost = new InputPostDto();

            newPost.WallId    = wallId;
            newPost.OnlyImage = onlyImage;
            return(PartialView("PostingForm", newPost));
        }
Example #4
0
        public ActionResult RePost(InputPostDto inputPostDto, int originalId, int currentWallId, int rePostWallId)
        {
            UserDto currentUser = (UserDto)Session["session"];

            inputPostDto.WallId   = rePostWallId;
            inputPostDto.AuthorId = currentUser.Id;
            postService.RePost(inputPostDto, originalId);
            return(RedirectToAction("Wall", new { wallId = currentWallId }));
        }
Example #5
0
        public ActionResult CommentForm(int wallId, int hostId)
        {
            InputPostDto newPost = new InputPostDto();

            newPost.WallId     = wallId;
            newPost.OnlyImage  = false;
            ViewData["hostId"] = hostId;
            return(PartialView("CommentForm", newPost));
        }
Example #6
0
        public ActionResult PostComment(InputPostDto comment, int hostId, int wallId)
        {
            UserDto user = (UserDto)Session["session"];

            comment.WallId   = wallId;
            comment.AuthorId = user.Id;
            postService.Post(comment, hostId);
            return(RedirectToAction("Wall", new { wallId = wallId }));
        }
Example #7
0
        public ActionResult RePostForm(int wallId, int originalId)
        {
            UserDto      userDto = (UserDto)Session["session"];
            InputPostDto newPost = new InputPostDto();

            newPost.OnlyImage             = false;
            newPost.WallId                = wallId;
            ViewData["originalId"]        = originalId;
            ViewData["destinationPoints"] = new SelectList(dialogService.GetPoints(userDto.Login), "DestinationWallId", "Title");
            return(PartialView("RePostForm", newPost));
        }
Example #8
0
        public void Post(InputPostDto inputPostDto)
        {
            SocialNetworkDbContext context = new SocialNetworkDbContext();
            Post           post            = mapper.FromInputPostDtoToPost(inputPostDto);
            Post           addedPost       = postManager.AddNewPost(post);
            List <Content> contents        = contentMapper.GetContentList(inputPostDto.Media);
            List <Content> addedContent    = contentManager.AddContent(contents);
            Post           newPost         = context.Posts.Where(p => p.Id == addedPost.Id).First();

            newPost.Content = addedContent;
            context.SaveChanges();
        }
Example #9
0
        public ActionResult ShowGroupPostingForm(int wallId, bool onlyImage, int groupId)
        {
            InputPostDto newPost = new InputPostDto();

            newPost.WallId    = wallId;
            newPost.OnlyImage = onlyImage;
            UserDto    user = (UserDto)Session["session"];
            GroupRoles role = groupService.GetUserRoleInGroup(user.Id, groupId);

            ViewData["role"] = role;
            return(PartialView("GroupPostingForm", newPost));
        }
Example #10
0
        public Post FromInputPostDtoToPost(InputPostDto inputPostDto)
        {
            Post post = new Post()
            {
                AuthorId    = inputPostDto.AuthorId,
                Rating      = 0,
                Text        = inputPostDto.Text,
                PostingDate = DateTime.Now,
                WallId      = inputPostDto.WallId
            };

            return(post);
        }
Example #11
0
 public ActionResult Post(InputPostDto postDto, int wallId /*, List<HttpPostedFileBase> file*/)
 {
     postDto.AuthorId = ((UserDto)Session["session"]).Id;
     postDto.WallId   = wallId;
     //if (file != null)
     //{
     //  postService.Post(postDto, file);
     //}
     //else
     //{
     postService.Post(postDto);
     //}
     return(RedirectToAction("Wall", new { wallId = wallId }));
 }
Example #12
0
        public Post FromInputPostDtoToPost(InputPostDto inputPostDto)
        {
            Post post = new Post()
            {
                AuthorId    = inputPostDto.AuthorId,
                Rating      = 0,
                PostingDate = DateTime.Now,
                WallId      = inputPostDto.WallId,
            };

            if (inputPostDto.Text == null)
            {
                post.Text = "";
            }
            else
            {
                post.Text = inputPostDto.Text;
            }
            return(post);
        }
Example #13
0
        public void Post(InputPostDto InputPostDto)
        {
            Post post = mapper.FromInputPostDtoToPost(InputPostDto);

            postManager.AddNewPost(post);
        }