コード例 #1
0
        internal Comment Edit(Comment updated)
        {
            Comment data = GetById(updated.Id);

            data.Body = updated.Body != null ? updated.Body : data.Body;

            return(_repo.Edit(data));
        }
コード例 #2
0
        //EDIT/PUT
        internal Comment Edit(Comment editComments)
        {
            Comment original = GetById(editComments.CommentId);

            // original.Name = editComments.Name != null ? editComments.Name : original.Name;
            // original.CastleId = editComments.CastleId != null ? editComments.CastleId : original.CastleId;

            return(_repo.Edit(original));
        }
コード例 #3
0
        internal Comment Edit(Comment updatedComment)
        {
            Comment found = Get(updatedComment.Id);

            if (found.AuthorId != updatedComment.AuthorId)
            {
                throw new Exception("Invalid Request");
            }
            found.Body = updatedComment.Body;
            return(_repo.Edit(found));
        }
コード例 #4
0
        internal Comment Edit(Comment updated, string id)
        {
            Comment original = GetById(updated.Id);

            if (original.CreatorId != id)
            {
                throw new Exception("Access Denied: You can only edit content you have created.");
            }
            updated.Body = updated.Body == null ? original.Body : updated.Body;

            return(_cr.Edit(updated));
        }
コード例 #5
0
ファイル: CommentController.cs プロジェクト: deep39/LFA.MVC
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                Comment objComment = new Comment();
                objComment.CommentId      = int.Parse(collection[1].ToString());
                objComment.CommentContent = collection[2].ToString();
                objComment.PostId         = int.Parse(collection[3].ToString());
                objComment.UserId         = int.Parse(collection[4].ToString());


                // TODO: Add update logic here
                repComments.Edit(objComment);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #6
0
 // PUT: api/ManagerComment/5
 public void Put(int id, ManagerComment comment)
 {
     comment.managerid = id;
     CommentsRepository.Edit(comment);
 }
コード例 #7
0
 // PUT: api/ManagerComment/5
 public void Put(int id, managercomments comment)
 {
     comment.managercomment_id = id;
     CommentsRepository.Edit(comment);
 }