public bool Delete(int id) { var post = _context.Posts.FirstOrDefault(post => post.Id == id); if (post == null) { return(false); } _context.Remove(post); return(true); }
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); }