/// <summary> /// method for editing the article /// </summary> private void SaveExecute() { try { using (WarehouseEntities1 context = new WarehouseEntities1()) { int id = article.ArticleID; // finding the article with the ID tblArticle newArticle = (from x in context.tblArticles where x.ArticleID == id select x).First(); if (article.Article.All(Char.IsLetter)) { newArticle.Article = article.Article; } else { MessageBox.Show("Wrong article name input, please try again."); } newArticle.Code = article.Code; newArticle.Amount = article.Amount; newArticle.Price = article.Price; newArticle.Stored = false; newArticle.ArticleID = article.ArticleID; context.SaveChanges(); IsUpdateArticle = true; } editArticle.Close(); } catch (Exception) { MessageBox.Show("Wrong inputs, please try again."); } }