public Book Get(int id)
 {
     if (repasitory.GetAll().Where(b => b.Id == id).ToList().Count != 0)
     {
         return(repasitory.Get(id));
     }
     return(null);
 }
 public Category Get(int id)
 {
     if (repasitory.GetAll().Where(c => c.Id == id).ToList().Count != 0)
     {
         return(repasitory.Get(id));
     }
     return(null);
 }
 public Author Get(int id)
 {
     if (repasitory.GetAll().Where(a => a.Id == id).ToList().Count != 0)
     {
         return(repasitory.Get(id));
     }
     return(null);
 }
Esempio n. 4
0
 public Publications Get(int id)
 {
     if (repasitory.GetAll().Where(p => p.Id == id).ToList().Count != 0)
     {
         return(repasitory.Get(id));
     }
     return(null);
 }
 public string Un_Register(int id)
 {
     if (repasitory.GetAll().Where(cb => cb.Id == id).ToList().Count != 0)
     {
         repasitory.Delete(id);
         repasitory.Save();
         return($"the category-book with id :{id} is deleted...");
     }
     return("Not Found any cattegory-book to un-register");
 }
        public string Register(BookCategory bookcat)
        {
            var testbook     = b_repository.GetAll().Where(ab => ab.Id == bookcat.IdBook).ToList().Count;
            var testcategory = c_repository.GetAll().Where(ab => ab.Id == bookcat.IdCategory).ToList().Count;

            if (testcategory == 0)
            {
                return("Not Found any author whit this id");
            }
            if (testbook == 0)
            {
                return("Not Found any book whit this id");
            }

            repasitory.Insert(bookcat);
            repasitory.Save();
            return(bookcat.Id + " register...");
        }
Esempio n. 7
0
        public string Register(BookAuthor bookAuthor)
        {
            var testbook   = b_repository.GetAll().Where(ab => ab.Id == bookAuthor.IdBook).ToList().Count;
            var testauthor = a_repository.GetAll().Where(ab => ab.Id == bookAuthor.IdAuthor).ToList().Count;

            if (testauthor == 0)
            {
                return("Not Found any author with this id");
            }
            if (testbook == 0)
            {
                return("Not Found any book with this id");
            }

            repasitory.Insert(bookAuthor);
            repasitory.Save();
            return(bookAuthor.Id + " register...");
        }