public static bool changeToBorrowed(int code, int status)
    {
      Lendings lending = DalLending.checkLending(code);


      return DalBook.changeStatus(lending.IdBook, status);
    }
    public static bool changeToFree(int code)
    {
      Lendings lending = DalLending.checkLending(code);
      return DalBook.changeStatus(lending.IdBook, 2);


    }
 public static bool changeStatus(int code)
 {
   int status;
   Lendings lending = DalLending.checkLending(code);
   BooksInLibrary book = DalLending.lendingBook(lending.IdBook);
   if (book.IdStatus == 3)
     status = 1;
   else
     status = 2;
   return DalBook.changeStatus(lending.IdBook, status);
 }
    public static bool updateStatusEveryDay()
    {
      DateTime dateTime = DateTime.Now;
      BooksInLibrary[] catchBooksArray = DalBook.getAllCatchBooks();//all catch books
      foreach (var catchBook in catchBooksArray)
      {
        int days = DalLending.getStartLending(catchBook.IdBook);
        if (days != -1)
        {
          if (DateTime.Now.Day - days > 2)
          {
            if (!DalBook.changeStatus(catchBook.IdBook, 2))//change status to free
              return false;
          }
        }
        else
        {
          return false;
        }
      }
      return true;

    }
    public static bool changeBookStatuse(int idBook, int idStatus)
    {
      return DalBook.changeStatus(idBook, idStatus);

    }