public async Task <ActionResult> Delete(OperationTypeViewModel vm) { OperationTypeDto toDelete = Mapper.Map <OperationTypeViewModel, OperationTypeDto>(vm); await _operationTypeRepo.Delete(toDelete.Id); return(RedirectToAction("Index")); }
private void BtnDeleteCategory_Click(object sender, RoutedEventArgs e) { OperationTypeDto category = GetClickedCategory(sender); try { _operationTypeRepo.Delete(category.Id); } catch { MessageBox.Show("Unable to delete category. It has been used for other transactions"); } InitializeCategories(); }