Beispiel #1
0
 protected async override Task OnInitializedAsync()
 {
     Saved = false;
     if (!string.IsNullOrEmpty(Id))
     {
         var itemId = Convert.ToInt32(Id);
         Item = await TodoDataService.GetItemDetail(itemId);
     }
 }
Beispiel #2
0
        protected async void DeleteItem()
        {
            if (!String.IsNullOrEmpty(Id))
            {
                var itemId = Convert.ToInt32(Id);
                await TodoDataService.DeleteItem(itemId);

                NavigationManager.NavigateTo(nameof(ItemOverView));
            }

            Message = "Something went wrong, unable to delete";
        }
Beispiel #3
0
        protected async Task HandleValidRequest()
        {
            if (string.IsNullOrEmpty(Id))
            {
                var res = await TodoDataService.AddItem(Item);

                if (res != null)
                {
                    Saved   = true;
                    Message = "Item has been added!";
                }
                else
                {
                    Message = "Something went wrong!";
                }
            }
            else
            {
                await TodoDataService.UpdateItem(Item);

                Saved   = true;
                Message = "Item has been updated!";
            }
        }
        protected async Task HandleValidRequest()
        {
            if (String.IsNullOrEmpty(Id)) // We need to add the item
            {
                var res = await TodoDataService.AddItem(Item);

                if (res != null)
                {
                    Saved   = true;
                    Message = "Item has been added";
                }
                else
                {
                    Message = "Something went wrong";
                }
            }
            else   // We are updating the item
            {
                await TodoDataService.UpdateItem(Item);

                Saved   = true;
                Message = "Item has been updated";
            }
        }
        protected async override Task OnInitializedAsync()
        {
            var itemId = Convert.ToInt32(Id);

            Item = await TodoDataService.GetItemDetails(itemId);
        }
Beispiel #6
0
 public MainPage()
 {
     this.InitializeComponent();
     _todoService = new TodoDataService();
 }
Beispiel #7
0
 public TodoController()
 {
     todoDataService = new TodoDataService();
 }
 public void TodoDataServiceInitialize()
 {
     _todoService = new TodoDataService();
     _todos       = new ObservableCollection <Todo>();
 }