private bool CreateAuthors()
        {
            using (MyLibraryEntities db = new MyLibraryEntities())
            {
                Author tableAuthor = new Author();
                if (GoChek.IsEmpityOrMaxChar(textBoxAuthorsName.Text) && GoChek.IsStringValue(textBoxAuthorsName.Text))
                {
                    tableAuthor.AUTName = GoChek.ClearValue;
                }
                else
                {
                    return(false);
                }
                if (GoChek.IsEmpityOrMaxChar(textBoxAuthorsSurname.Text) && GoChek.IsStringValue(textBoxAuthorsSurname.Text))
                {
                    tableAuthor.Surname = GoChek.ClearValue;
                }
                else
                {
                    return(false);
                }

                db.Authors.Add(tableAuthor);
                return(GoChek.isSave(db.SaveChanges()));
            }
        }
 private bool CreateBooks()
 {
     using (MyLibraryEntities db = new MyLibraryEntities())
     {
         Book book = new Book();
         if (GoChek.IsEmpityOrMaxChar(textBoxBooksName.Text) && GoChek.IsStringValue(textBoxBooksName.Text))
         {
             book.BKName = GoChek.ClearValue;
         }
         if (GoChek.IsEmpityOrMaxChar(textBoxBooksPrice.Text) && GoChek.isPrice(textBoxBooksPrice.Text))
         {
             book.Price = Convert.ToDecimal(GoChek.ClearValue);
         }
         else
         {
             return(false);
         }
         book.CatagoryId = (db.Catagories.Where(x => x.CTName == comboBoxBooksCategory.SelectedItem.ToString()).FirstOrDefault().Id);
         book.BKCount    = 10;
         db.Books.Add(book);
         AuthorsBook authorsBook = new AuthorsBook();
         authorsBook.AuthorId = db.Authors.Where(x => x.AUTName == comboBoxBooksAuthors.SelectedItem.ToString()).FirstOrDefault().Id;
         authorsBook.BookId   = book.Id;
         db.AuthorsBooks.Add(authorsBook);
         return(GoChek.isSave(db.SaveChanges()));
     }
 }
 private bool CreateCategory()
 {
     using (MyLibraryEntities db = new MyLibraryEntities())
     {
         Catagory tableCatagory = new Catagory();
         if (GoChek.IsEmpityOrMaxChar(textBoxCategoriesName.Text) && GoChek.IsStringValue(textBoxCategoriesName.Text))
         {
             tableCatagory.CTName = GoChek.ClearValue;
         }
         else
         {
             return(false);
         }
         db.Catagories.Add(tableCatagory);
         return(GoChek.isSave(db.SaveChanges()));
     }
 }
        private bool CreateClients()
        {
            using (MyLibraryEntities db = new MyLibraryEntities())
            {
                Client tableClient = new Client();
                if (GoChek.IsEmpityOrMaxChar(textBoxClientsName.Text) && GoChek.IsStringValue(textBoxClientsName.Text))
                {
                    tableClient.CLName = GoChek.ClearValue;
                }
                else
                {
                    return(false);
                }
                if (GoChek.IsEmpityOrMaxChar(textBoxClientsSurname.Text) && GoChek.IsStringValue(textBoxClientsSurname.Text))
                {
                    tableClient.Surname = GoChek.ClearValue;
                }
                else
                {
                    return(false);
                }
                if (GoChek.IsEmpityOrMaxChar(textBoxClientsEmail.Text) && GoChek.IsEmailValue(textBoxClientsEmail.Text))
                {
                    tableClient.Email = GoChek.ClearValue;
                }
                else
                {
                    return(false);
                }
                if (GoChek.IsEmpityOrMaxChar(textBoxClientsPhone.Text) && GoChek.IsPhoneValue(textBoxClientsPhone.Text))
                {
                    tableClient.Phone = GoChek.ClearValue;
                }
                else
                {
                    return(false);
                }

                db.Clients.Add(tableClient);
                return(GoChek.isSave(db.SaveChanges()));
            }
        }