Пример #1
0
        public bool UpdateNote_Comment(Note_CommentItem model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity = ctx
                             .Note_Comments
                             .Single(e => e.NoteId == model.NoteId && e.CommentId == model.CommentId);

                entity.CommentId = model.CommentId;
                return(ctx.SaveChanges() == 1);
            }
        }
Пример #2
0
        public IHttpActionResult Put(Note_CommentItem note_comment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var service = CreateNote_CommentService();

            if (!service.UpdateNote_Comment(note_comment))
            {
                return(InternalServerError());
            }
            return(Ok());
        }
Пример #3
0
        public bool CreateComment(Note_CommentItem model)
        {
            var entity =
                new Note_Comment()
            {
                CommentId = model.CommentId,
                NoteId    = model.NoteId
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Note_Comments.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }