void HandleUpdateTaskSelected()
        {
            if (Category.IsEntityDataChanged)
            {
                var commande = new EditCategoryCommand() { Name = Category.Name, Color = Category.Color, id = Category.Id };
                CategoryService.UpdateCategory(commande);

                var result = CategoryService.UpdateCategory(commande);

            }
            NavigateTo("/MainPage.xaml?update=category", null);

            Dispose();
        }
Пример #2
0
        public Result<Category> UpdateCategory(EditCategoryCommand editCategoryCommand)
        {
            return Result<Category>.SafeExecute<CategoryService>(result =>
            {

                using (DataContext = new RmmDataContext(RmmDataContext.CONNECTIONSTRING))
                {

                    var entityToUpdate = DataContext.Category.Log().Where(t => t.ID == editCategoryCommand.id).First();

                    entityToUpdate.ID = editCategoryCommand.id;
                    entityToUpdate.Name = editCategoryCommand.Name;
                    entityToUpdate.Color = editCategoryCommand.Color;
                    entityToUpdate.CreatedDate = DateTime.Now;


                    DataContext.SubmitChanges();

                    result.Value = entityToUpdate;
                }

            }, () => "error");
        }