public BookDataShubhi Update(BookDataShubhi dataChanges) { var bookdata = context.BookDatas.Attach(dataChanges); bookdata.State = Microsoft.EntityFrameworkCore.EntityState.Modified; context.SaveChanges(); return(dataChanges); }
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 }
public BookDataShubhi Delete(int ISBNNumber) { BookDataShubhi bookDataShubhi = context.BookDatas.Find(ISBNNumber); if (bookDataShubhi != null) { context.BookDatas.Remove(bookDataShubhi); context.SaveChanges(); } return(bookDataShubhi); }
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); }
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); }
public BookDataShubhi Add_data(BookDataShubhi bookDataShubhi) { context.BookDatas.Add(bookDataShubhi); context.SaveChanges(); return(bookDataShubhi); }