Exemplo n.º 1
0
        public async Task <CommentDTO> Update(CommentDTO comment)
        {
            var dbComment = mapper.Map <Comment>(comment);

            dbComment = await commentManager.Update(dbComment);

            return(mapper.Map <CommentDTO>(dbComment));
        }
Exemplo n.º 2
0
        public RedirectToRouteResult CommentSeen(int?id)
        {
            var commentSeen = commentManager.GetById((int)id);
            var requisition = _requisitionManager.GetById(commentSeen.RequsitionId);

            commentSeen.ReceiverSeenTime = DateTime.Now;
            commentSeen.IsReceiverSeen   = true;
            commentManager.Update(commentSeen);
            return(RedirectToAction("Details_V2", new { id = requisition.Id }));
        }
Exemplo n.º 3
0
        public string UpdateComment(string text, int commentId)
        {
            var comment = commentManager.GetById(commentId);

            comment.Description = text;
            if (Convert.ToInt32(User.Identity.GetUserId()) == comment.UserId)
            {
                return(commentManager.Update(comment) == true?JsonConvert.SerializeObject(comment) : null);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 4
0
        public IActionResult Edit(int id, [Bind("Id,OwnerId,Description,PostId")] Comment comment)
        {
            if (id != comment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    commentManager.Update(comment);
                }
                catch (DbUpdateConcurrencyException)
                {
                }
                return(View(comment));
            }
            return(View(comment));
        }
Exemplo n.º 5
0
 public async Task <ApiResponse> Put([FromBody] CommentDto comment)
 => ModelState.IsValid ?
 await _commentManager.Update(comment) :
 new ApiResponse(Status400BadRequest, "Comment Model is Invalid");
 public void Update(UpdateCommentInput input)
 {
     Models.Comment output = Mapper.Map <UpdateCommentInput, Models.Comment>(input);
     _commentManager.Update(output);
 }