Example #1
0
        public PictureComment AddPictureComment(PictureComment comment, Picture picture, User user)
        {
            comment.User = user;

            picture.Comments.Add(comment);

            dbContext.SaveChanges();
            return(comment);
        }
        public PictureComment AddPictureComment(CommentModel comment, Picture picture, User user)
        {
            var pictureComment = new PictureComment()
            {
                Text      = comment.Text,
                CreatedAt = DateTime.Now
            };

            return(this.pictureManager.AddPictureComment(pictureComment, picture, user));
        }
Example #3
0
 private void btnPlaceComment_Click(object sender, RoutedEventArgs e)
 {
     if (!txtComment.Text.Equals(""))
     {
         PictureComment pc = new PictureComment();
         pc.Comment   = txtComment.Text;
         pc.PictureId = _vm.ActivePicture.PictureId;
         pc.PlaceId   = _vm.ActivePicture.Place.PlaceId;
         pc.UserId    = _vm.ActiveUser.UserId;
         _vm.SavePictureComment(pc);
         txtComment.Text = "";
     }
 }
Example #4
0
        public IActionResult PostPictureComment([FromBody] PictureComment comment)
        {
            var authenticatedUser = GetAuthenticatedUserNetname();

            var affectedUser = _pictureRepo.AddPictureComment(comment);

            if (string.IsNullOrEmpty(affectedUser))
            {
                return(NotFound());
            }

            _logRepo.LoggerAsync(authenticatedUser, Log.Action.AddComment, affectedUser);

            return(Ok());
        }
Example #5
0
 //ADDPICTURECOMMENT & LIST OF PICTURECOMMENTS
 public async void AddPictureComment(PictureComment picturecomment)
 {
     using (HttpClient client = new HttpClient())
     {
         try
         {
             string      url     = string.Format("{0}{1}", URL, "picturecomment");
             string      json    = JsonConvert.SerializeObject(picturecomment);
             HttpContent content = new StringContent(json);
             content.Headers.Clear();
             content.Headers.Add("Content-Type", "application/json");
             await client.PostAsync(url, content);
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
Example #6
0
        public async Task <HttpResponseMessage> SavePictureComment(PictureComment pictureComment)
        {
            try
            {
                if (pictureComment == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest));
                }
                pictureComment.UserName = HttpContext.Current.User.Identity.Name;
                await Repository.SavePictureComment(pictureComment);

                return(Request.CreateResponse(HttpStatusCode.OK, pictureComment));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(new ResponseModel {
                    HasError = true, ErrorMessage = ex.Message
                }));
            }
        }
Example #7
0
 public void SavePictureComment(PictureComment picturecomment)
 {
     shredderService.AddPictureComment(picturecomment);
 }
 public PictureComment AddPictureComment(PictureComment picturecomment)
 {
     return(this.context.PictureComments.Add(picturecomment));
 }
 public PictureComment AddPictureComment(PictureComment picturecomment)
 {
     picturecomment = uow.PictureCommentRepository.AddPictureComment(picturecomment);
     uow.Save();
     return(picturecomment);
 }
Example #10
0
        private void PhotoInfoReceived(PictureComment xamlRep, string info)
        {
            // create the xml document so we can pull from it what we want
            XmlDocument doc = new XmlDocument();
            doc.Load(new StringReader(info));

            // depending on the photo info - display the different buttons
            // Location information
            XmlNode node = doc.SelectSingleNode("/photo/location");
            if (node != null)
            {
                xamlRep.pictureVisual.EnableLocation();
            }
            else
            {
                xamlRep.pictureVisual.DisableLocation();
            }

            // Comment information
            XmlNode commentNode = doc.SelectSingleNode("/photo/comments");
            if (commentNode != null && Int32.Parse(commentNode.InnerText) > 0)
            {
                xamlRep.pictureVisual.EnableComments();
            }
            else
            {
                xamlRep.pictureVisual.DisableComments();
            }
        }
Example #11
0
 private void PhotoCommentsReceived(PictureComment xamlRep, string comments)
 {
     // bind to the xml data
     xamlRep.commentList.SetComments(comments);
 }