Esempio n. 1
0
        public async Task <IActionResult> PutDComment(int id, DComment dComment)
        {
            if (id != dComment.Id)
            {
                return(BadRequest());
            }

            _context.Entry(dComment).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DCommentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <DComment> > PostDComment(DComment dComment)
        {
            _context.DComments.Add(dComment);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDComment", new { id = dComment.Id }, dComment));
        }
Esempio n. 3
0
        public List <DComment> AddComment(DComment newComment)
        {
            _commentLibrary.Add(newComment);

            //map and add to database

            return(_commentLibrary);
        }