Ejemplo n.º 1
0
        public int kitapGuncelle(Books book)
        {
            KiKapEntities db = new KiKapEntities();

            Books yeni = db.Books.FirstOrDefault(c => c.ID == book.ID);

            yeni.bookName        = book.bookName;
            yeni.author          = book.author;
            yeni.type            = book.type;
            yeni.editor          = book.editor;
            yeni.translator      = book.translator;
            yeni.pageNumbers     = book.pageNumbers;
            yeni.format_         = book.format_;
            yeni.publisher       = book.publisher;
            yeni.publicationDate = book.publicationDate;
            yeni.language        = book.language;
            yeni.edition         = book.edition;
            yeni.price           = book.price;
            yeni.size            = book.size;
            yeni.ISBN            = book.ISBN;


            try
            {
                db.SaveChanges();
                return(1);
            }
            catch (Exception)
            {
                return(-1);
            }
        }
Ejemplo n.º 2
0
        public int kitapSil(Books book)
        {
            KiKapEntities db = new KiKapEntities();

            try
            {
                List <Books> bookList = db.Books.Where(c => c.ID == book.ID).ToList();

                foreach (var item in bookList)
                {
                    db.Books.Remove(item);
                    db.SaveChanges();
                }


                return(1);
            }
            catch (Exception)
            {
                return(-1);
            }
        }
Ejemplo n.º 3
0
        public int kitapEkle(Books book)
        {
            KiKapEntities db = new KiKapEntities();

            List <Books> kitapVarMi = db.Books.Where(c => c.bookName.Contains(book.bookName) && c.author.Contains(book.author)).ToList();

            if (kitapVarMi.Count > 0)
            {
                return(0);
            }

            try
            {
                db.Books.Add(book);
                db.SaveChanges();
                return(1);
            }
            catch (Exception)
            {
                return(-1);
            }
        }