Пример #1
0
        /// <summary>
        /// Modify the selected category in a window
        /// </summary>
        /// <param name="window">The window where the modification take place</param>
        public void Modify(IClosable window)
        {
            // check if the categoryname was modified
            if (SelectedCategory.IsNameModified())
            {
                // make sure there is no category with the same name already in database
                if (CategoryExists(SelectedCategory.Category.CategoryName))
                {
                    windowService.UserMessage("Létezik már ilyen névvel kategória, kérem adjon meg másik nevet!");
                    return;
                }
            }

            // try to modify, if any changes was made
            if (SelectedCategory.IsModified())
            {
                if (Modify())
                {
                    windowService.UserMessage("A kategória sikeresen módosításra került!");
                    IsModified = true;
                }
                else
                {
                    windowService.UserMessage("A kategóriát nem sikerül módosítani!");
                }
            }
            else
            {
                windowService.UserMessage("Nem történt módosítás.");
            }

            // close the window anyway
            window.Close();
        }