コード例 #1
0
        public BookDataShubhi Update(BookDataShubhi dataChanges)
        {
            var bookdata = context.BookDatas.Attach(dataChanges);

            bookdata.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            context.SaveChanges();
            return(dataChanges);
        }
コード例 #2
0
        public BookDataShubhi Delete(int ISBNNumber)
        {
            BookDataShubhi bookDataShubhi = _bookdatalist.FirstOrDefault(e => e.ISBNNumber == ISBNNumber);

            if (bookDataShubhi != null)
            {
                _bookdatalist.Remove(bookDataShubhi);
            }
            return(bookDataShubhi);//return the deleted data
        }
コード例 #3
0
        public BookDataShubhi Delete(int ISBNNumber)
        {
            BookDataShubhi bookDataShubhi = context.BookDatas.Find(ISBNNumber);

            if (bookDataShubhi != null)
            {
                context.BookDatas.Remove(bookDataShubhi);
                context.SaveChanges();
            }
            return(bookDataShubhi);
        }
コード例 #4
0
        public BookDataShubhi Update(BookDataShubhi dataChanges)
        {
            BookDataShubhi bookDataShubhi = _bookdatalist.FirstOrDefault(e => e.ISBNNumber == dataChanges.ISBNNumber);

            if (bookDataShubhi != null)
            {
                bookDataShubhi.AuthorName = dataChanges.AuthorName;
                bookDataShubhi.Publisher  = dataChanges.Publisher;
                bookDataShubhi.Title      = dataChanges.Title;
            }
            return(bookDataShubhi);
        }
コード例 #5
0
 public BookDataShubhi Add_data(BookDataShubhi bookDataShubhi)
 {
     bookDataShubhi.ISBNNumber = _bookdatalist.Max(e => e.ISBNNumber) + 1;//finds the max isbn number and adds it by 1 to make it the new isbn id
     _bookdatalist.Add(bookDataShubhi);
     return(bookDataShubhi);
 }
コード例 #6
0
 public BookDataShubhi Add_data(BookDataShubhi bookDataShubhi)
 {
     context.BookDatas.Add(bookDataShubhi);
     context.SaveChanges();
     return(bookDataShubhi);
 }