Exemplo n.º 1
0
        public bool Delete(int id)
        {
            var post = _context.Posts.FirstOrDefault(post => post.Id == id);

            if (post == null)
            {
                return(false);
            }
            _context.Remove(post);
            return(true);
        }
Exemplo n.º 2
0
        public bool Delete(int id)
        {
            var category = _context.Categories.FirstOrDefault(category => category.Id == id);

            if (category == null)
            {
                return(false);
            }
            _context.Remove(category);
            _context.SaveChanges();
            return(true);
        }