Beispiel #1
0
 public void Add(Book book)
 {
     if (_bookDal.Get(b => b.Name == book.Name) == null)
     {
         _bookDal.Add(book);
     }
 }
        public IResult Delete(int id)
        {
            var value = _bookDal.Get(x => x.Id == id);

            _bookDal.Delete(value);
            return(new SuccessResult());
        }
Beispiel #3
0
 public void Add(Book book)
 {
     if (_bookDal.Get(b => b.Name == book.Name && b.AuthorId == book.AuthorId) == null)
     {
         _bookDal.Add(book);
         return;
     }
     throw new Exception("Bu kitap zaten ekli");
 }
Beispiel #4
0
 public void Add(Book book)
 {
     if (_bookDal.Get(b => b.Name == book.Name && b.Authorid == book.Authorid) == null)
     {
         _bookDal.Add(book);
     }
     else
     {
         throw new Exception("Bu kitap adı zaten mevcut");
     }
 }
Beispiel #5
0
 public void Add(Book book)
 {
     if (_bookDal.Get(filter: b => b.Name == book.Name && b.AuthorId == book.AuthorId) == null)
     {
         _bookDal.Add(book);
     }
     else
     {
         throw new Exception(message: "Bu Kitap adı zaten mevcut");
     }
 }
Beispiel #6
0
 public void Add(Book book)
 {
     // İş Kodları
     if (_bookDal.Get(filter: b => b.Name == book.Name && b.AuthorId == book.AuthorId) == null)
     {
         _bookDal.Add(book);
     }
     else
     {
         throw new Exception(message: "Girmek istediğiniz kitap adı zaten var!");
     }
 }
Beispiel #7
0
 public void Add(Book book)
 {
     // Bu kontrol update içinde gerekeceğinden burayı farklı şekilde yönetmek gerek
     if (_bookDal.Get(filter: b => b.Name == book.Name) == null)
     {
         _bookDal.Add(book);
     }
     else
     {
         throw new Exception(message: "Bu kitap adı zaten mevcut");
     }
 }
Beispiel #8
0
 public void Add(Book entity)
 {
     //iş kodu
     //Örnegin bu iş kuralını biz birden fazla yerde kullanabiliriz bu yüzden bu kod kötü bunu ayrı bir yerde ele almamız lazım.
     if (_bookDal.Get(b => b.Name == entity.Name && b.AuthorId == entity.AuthorId) == null)
     {
         _bookDal.Add(entity);
     }
     else
     {
         throw new Exception("Bu kitap daha önce eklenmiş");
     }
 }
Beispiel #9
0
        public void Add(Book book)
        {
            // kitap eklerken kurallar varsa buraya yazılır.
            // İş kodu

            if (_bookDal.Get(b => b.Name == book.Name && book.AuthorId == book.AuthorId) == null)
            {
                _bookDal.Add(book);
            }
            else
            {
                throw new Exception("Bu kitap adı zaten mevcut...");
            }
        }
 public Book Get(Expression <Func <Book, bool> > filter)
 {
     try
     {
         return(_iBookDal.Get(filter));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #11
0
		public void Add(Book book)
		{
			//throw new NotImplementedException();
			//EfBookDal efBookDal = new EfBookDal();
			_bookDal.Add(book);
			if (_bookDal.Get(b=>b.Name == book.Name && b.AuthorId==book.AuthorId ) == null)
			{
				_bookDal.Add(book);
			}
			throw new Exception("Bu kitap adı zaten var");
		}
Beispiel #12
0
 public Book GetById(int id)
 {
     return(_bookDal.Get(x => x.Id == id));
 }
Beispiel #13
0
 public Book Get(Func <Book, bool> condition = null)
 {
     return(_bookdal.Get(condition));
 }
 public Book Get(Expression <Func <Book, bool> > filter)
 {
     return(_bookDal.Get(filter));
 }
 public IDataResult <Book> GetById(int bookId)
 {
     return(new SuccessDataResult <Book>(_bookDal.Get(b => b.BookId == bookId), Messages.BooksIdListed));
 }
Beispiel #16
0
 public Book GetById(int bookId)
 {
     return(_bookDal.Get(p => p.BookId == bookId));
 }
Beispiel #17
0
 public IDataResult <Book> GetByBookId(int bookid)
 {
     return(new SuccessDataResult <Book>(_bookDal.Get(book => book.BookId == bookid)));
 }
 public IDataResult <Book> GetById(int bookId)
 {
     return(new SuccessDataResult <Book>(_bookDal.Get(p => p.BookId == bookId)));
 }
Beispiel #19
0
 public Book GetById(int bookId)
 {
     return(_bookDal.Get(b => b.Id == bookId));
 }
Beispiel #20
0
 public IDataResult <Book> CheckStock(string isbn)
 {
     return(new SuccessDataResult <Book>(_bookDal.Get(b => b.ISBN == isbn)));
 }