private async void UxRemoveItemButton_Clicked(object sender, RoutedEventArgs e) { var validDeleteIngredientRequest = await DeleteIngredientRequest.SendDeleteIngredientRequest(selectedIngredient._id); if (validDeleteIngredientRequest) { ContentDialog responseAlert = new ContentDialog { Title = "Delete Successful", Content = "Ingredient has been deleted from the remote database", CloseButtonText = "Ok" }; ContentDialogResult result = await responseAlert.ShowAsync(); } else { ContentDialog responseAlert = new ContentDialog { Title = "Delete Unsuccessful", Content = "Ingredient failed to be removed from the remote database", CloseButtonText = "Ok" }; ContentDialogResult result = await responseAlert.ShowAsync(); } await RefreshIngredientList(); uxIngredientPopup.IsOpen = false; }
public SuccessResponse Delete(DeleteIngredientRequest request) { try { var ingredient = _ingredientRepository.FindBy(request.Id); ingredient.ThrowExceptionIfRecordIsNull(); var isReference = _ingredientRepository.IsReference(request.Id); isReference.ThrowExceptionIfIsReference(); _ingredientRepository.Remove(ingredient); return(new SuccessResponse { IsSuccess = true }); } catch (DataAccessException) { throw new ApplicationException(); } }
public SuccessResponse Delete(DeleteIngredientRequest request) { return(_ingredientService.Delete(request)); }