Ejemplo n.º 1
0
 private void btnUpdateRecipe_Click(object sender, EventArgs e)
 {
     if (tBoxTitle.Text.Length >= 1 && richTextDescription.Text.Length >= 1 && richTextIngrediens.Text.Length >= 1 && cBoxCategoryDescription.SelectedIndex > -1)
     {
         var getCategoryId = new Category(cBoxCategoryDescription.Text);
         mainForm.UpdateRecipe(tBoxTitle.Text, richTextDescription.Text, richTextIngrediens.Text, getCategoryId.CategoryId);
         MessageBox.Show("Recept Uppdaterat");
         mainForm.FilllstBoxTitle();
         this.Close();
     }
     else
     {
         MessageBox.Show("Du måste fylla varje fält");
         FillInformation();
     }
 }
 private void btnCreateNewRecipe_Click(object sender, EventArgs e)
 {
     if (CheckIfTitleExist(tBoxTitle.Text))
     {
         if (tBoxTitle.Text.Length >= 1 && richTextDescription.Text.Length >= 1 && richTextIngrediens.Text.Length >= 1 && cBoxCategoryDescription.SelectedIndex > -1)
         {
             mainForm.CreateRecipe(tBoxTitle.Text, richTextDescription.Text, richTextIngrediens.Text, cBoxCategoryDescription.Text);
             MessageBox.Show("Receptet är skapat!");
             mainForm.FilllstBoxTitle();
             this.Close();
         }
         else
         {
             MessageBox.Show("Du måste fylla varje fält");
         }
     }
     else
     {
         MessageBox.Show("Titeln finns redan");
     }
 }