Exemplo n.º 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();
        }
Exemplo n.º 2
0
        public bool InsertBook(Book newBook)
        {
            var status = true;

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

            return(status);
        }
Exemplo n.º 3
0
 public void Dispose()
 {
     _libraryContext.SubmitChanges();
     _libraryContext.Dispose();
 }