Beispiel #1
0
        public async Task OnSaveDishCommandAsync()
        {
            if (string.IsNullOrWhiteSpace(_dishName))
            {
                await _userDialog.AlertAsync(DishNameMustNotBeEmpty);

                return;
            }
            if (string.IsNullOrWhiteSpace(_categoryType))
            {
                await _userDialog.AlertAsync(CategoryDishMustBeSelected);

                return;
            }

            DishModel dish = new DishModel()
            {
                Name         = _dishName,
                CategoryType = GetCategoryFromPicker(_categoryType)
            };
            var result = await _dishService.CreateAsync(dish);

            if (result.IsSuccess)
            {
                await OnDishCommandAsync();
            }
            else
            {
                await _userDialog.AlertAsync(ServerError);
            }
        }