public List <CategoryModel> FilterSearch([FromBody] CategorySearchModel model)
        {
            List <CategoryModel> models = new List <CategoryModel>();
            var list = _categoryAssigment.GetList();

            foreach (var item in list)
            {
                CategoryModel categoryModel = new CategoryModel();
                if (model.CategoryIds.Count(x => x.Equals(item.CategoryId)) > 0 || model.AuthorIds.Count(y => y.Equals(item.AuthorId)) > 0 || model.PublisherId == item.PublisherId)
                {
                    if (models.Count == 0)
                    {
                        categoryModel.Id   = item.CategoryId;
                        categoryModel.Name = item.CategoryName;

                        MongoBookModel book = new MongoBookModel();
                        book.AuthorId      = item.AuthorId;
                        book.AuthorName    = item.AuthorName;
                        book.AuthorSurname = item.AuthorSurname;
                        book.BookName      = item.BookName;
                        book.BookId        = item.BookId;
                        book.SignUrl       = item.SignUrl;

                        //gelen filtreye göre category ve onun kitaplarını listele sorun şu ki hangi kategorinin kitaplarının hangi sırayla geleceğni bilmiyoruz.
                        //    düzenlemek gerekiyor.
                    }
                    else
                    {
                    }
                }
            }
            return(null);
        }
        public List <CategoryModel> BookByCategory(Guid id)
        {
            List <CategoryTagAssigment> categoriesBook = _categoryAssigment.GetList(x => x.CategoryId == id);
            var categoriesId = categoriesBook.GroupBy(x => x.CategoryId).Select(x => x.FirstOrDefault()).ToList();

            List <CategoryModel> returnModel = new List <CategoryModel>();

            foreach (var category in categoriesId.ToList())
            {
                CategoryModel categoryModel = new CategoryModel();
                foreach (var item in categoriesBook.Where(x => x.CategoryId == category.CategoryId))
                {
                    MongoBookModel model = new MongoBookModel();
                    model.CategoryId    = item.CategoryId;
                    model.CategoryName  = item.CategoryName;
                    model.BookId        = item.BookId;
                    model.BookName      = item.BookName;
                    model.SignUrl       = item.SignUrl;
                    model.AuthorId      = item.AuthorId;
                    model.AuthorName    = item.AuthorName;
                    model.AuthorSurname = item.AuthorSurname;

                    categoryModel.Books.Add(model);
                }

                categoryModel.Id   = category.CategoryId;
                categoryModel.Name = category.CategoryName;
                returnModel.Add(categoryModel);
            }


            return(returnModel);
        }
        public List <CategoryModel> BookByPublisher(Guid id)
        {
            #region publisherTempSilinecek
            //List<CategoryTagAssigment> categasdoriesBook = _categoryAssigment.GetList();

            //string cate = "Doğan Kitap";
            //foreach (var item in categasdoriesBook)
            //{
            //    if (item.PublisherName == cate)
            //    {
            //        var filter = Builders<CategoryTagAssigment>.Filter.Eq("BookName", item.BookName);
            //        var update = Builders<CategoryTagAssigment>.Update.Set("PublisherId", "E86B40EA-DDB1-4525-F26D-08D6700D8555");
            //         _categoryAssigment.Update(filter, update);

            //    }

            //}

            //string c1ate = "Sel Yayıncılık";
            //foreach (var item in categasdoriesBook)
            //{
            //    if (item.PublisherName == c1ate)
            //    {
            //        var filter = Builders<CategoryTagAssigment>.Filter.Eq("BookName", item.BookName);
            //        var update = Builders<CategoryTagAssigment>.Update.Set("PublisherId", "7C05CB67-6734-4DE8-F4BF-08D670143054");
            //        _categoryAssigment.Update(filter, update);

            //    }

            //}

            //string c1aaste = "İletişim Yayıncılık";
            //foreach (var item in categasdoriesBook)
            //{
            //    if (item.PublisherName == c1aaste)
            //    {
            //        var filter = Builders<CategoryTagAssigment>.Filter.Eq("BookName", item.BookName);
            //        var update = Builders<CategoryTagAssigment>.Update.Set("PublisherId", "07E16C53-B86A-4EF1-F4C0-08D670143054");
            //        _categoryAssigment.Update(filter, update);

            //    }

            //}

            //string assdasdas = "İthaki Yayınları";
            //foreach (var item in categasdoriesBook)
            //{
            //    if (item.PublisherName == assdasdas)
            //    {
            //        var filter = Builders<CategoryTagAssigment>.Filter.Eq("BookName", item.BookName);
            //        var update = Builders<CategoryTagAssigment>.Update.Set("PublisherId", "4274AAC6-8CE1-44FB-F4C2-08D670143054");
            //        _categoryAssigment.Update(filter, update);

            //    }

            //}

            //string asassdasdas = "Yapı Kredi Yayınları";
            //foreach (var item in categasdoriesBook)
            //{
            //    if (item.PublisherName == asassdasdas)
            //    {
            //        var filter = Builders<CategoryTagAssigment>.Filter.Eq("BookName", item.BookName);
            //        var update = Builders<CategoryTagAssigment>.Update.Set("PublisherId", "44046DC0-86DF-4B58-F4C1-08D670143054");
            //        _categoryAssigment.Update(filter, update);

            //    }

            //}



            #endregion

            List <CategoryTagAssigment> categoriesBook = _categoryAssigment.GetList(x => x.PublisherId == id);
            var categoriesId = categoriesBook.GroupBy(x => x.CategoryId).Select(x => x.FirstOrDefault()).ToList();

            List <CategoryModel> returnModel = new List <CategoryModel>();

            foreach (var category in categoriesId.ToList())
            {
                CategoryModel categoryModel = new CategoryModel();
                foreach (var item in categoriesBook.Where(x => x.CategoryId == category.CategoryId))
                {
                    MongoBookModel model = new MongoBookModel();
                    model.CategoryId    = item.CategoryId;
                    model.CategoryName  = item.CategoryName;
                    model.BookId        = item.BookId;
                    model.BookName      = item.BookName;
                    model.SignUrl       = item.SignUrl;
                    model.AuthorId      = item.AuthorId;
                    model.AuthorName    = item.AuthorName;
                    model.AuthorSurname = item.AuthorSurname;
                    model.PublisherId   = item.PublisherId;
                    model.PublisherName = item.PublisherName;

                    categoryModel.Books.Add(model);
                }

                categoryModel.Id   = category.CategoryId;
                categoryModel.Name = category.CategoryName;
                returnModel.Add(categoryModel);
            }

            return(returnModel);
        }