Exemplo n.º 1
0
        /// <summary>
        /// Delete Comment
        /// </summary>
        /// <param name="id">Comment ID</param>
        /// <returns>saved changes</returns>
        public async Task DeleteCoAsync(int id)
        {
            Comments comment = await _context.Comments.FindAsync(id);

            if (comment != null)
            {
                _context.Remove(comment);
                await _context.SaveChangesAsync();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Delete Post
        /// </summary>
        /// <param name="id">post id</param>
        /// <returns>view</returns>
        public async Task DeleteAsync(int id)
        {
            Post post = await _context.Posts.FindAsync(id);

            if (post != null)
            {
                _context.Remove(post);
                await _context.SaveChangesAsync();
            }
        }