예제 #1
0
        public virtual void EditEntity()
        {
            ShowMessage("Enter new properties:");
            try
            {
                Console.WriteLine("Name:");
                category.Name = Console.ReadLine();

                Console.WriteLine("IsActive:");
                category.IsActive = Convert.ToBoolean(Console.ReadLine());

                Console.WriteLine("CategoryGroupId:");
                category.CategoryGroupId = Convert.ToInt32(Console.ReadLine());

                _unitOfWork.CategoryRepository.Update(category);
                _unitOfWork.SaveChanges();

                ShowSuccessMessage("Entity was updated successfully.");
            }
            catch (Exception)
            {
                ShowErrorMessage("Something wrong with data.");
            }
            finally
            {
                var categoryPage = new CategoryPage(category);
                categoryPage.Init();
            }
        }
        public virtual void ShowEntity()
        {
            var showPage = new CategoryPage((Category)buttons[CurrentPosition].Entity);

            showPage.Init();
        }