示例#1
0
        public void ReturnBook(HardCopy copy)
        {
            var history = new BookLeaningHistory
            {
                HardCopyId   = copy.Id,
                UserLeantTo  = copy.UserLeantTo.Value,
                LeantDate    = copy.LeantDate.Value,
                ReturnedDate = DateTime.Now
            };

            _libraryContext.BookLeaningHistories.InsertOnSubmit(history);
            _libraryContext.SubmitChanges();
        }
示例#2
0
        public bool InsertBook(Book newBook)
        {
            var status = true;

            try
            {
                _libraryContext.Books.InsertOnSubmit(newBook);
                _libraryContext.SubmitChanges();
            }
            catch (SqlException)
            {
                status = false;
            }

            return(status);
        }
示例#3
0
 public void Dispose()
 {
     _libraryContext.SubmitChanges();
     _libraryContext.Dispose();
 }