Пример #1
0
        private void toDos_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            var controller = new ToDoController();
            var toDo = controller.GetToDos(_ownerId).ToList()[e.Item.ItemIndex];

            if (toDo != null)
            {
                if (e.CommandName == "Delete")
                {
                    if (_settings.SoftDeleteToDos)
                    {
                        toDo.IsDeleted = true;
                        controller.UpdateToDo(toDo);
                    }
                    else
                    {
                        controller.DeleteToDo(toDo);
                    }
                }

                if (e.CommandName == "Restore")
                {
                    toDo.IsDeleted = false;
                    controller.UpdateToDo(toDo);
                }

                if (e.CommandName == "Complete")
                {
                    toDo.IsComplete = true;
                    controller.UpdateToDo(toDo);
                }

                BindGrid();
            }
        }