コード例 #1
0
        public async Task <ActionResult> Delete(OperationTypeViewModel vm)
        {
            OperationTypeDto toDelete = Mapper.Map <OperationTypeViewModel, OperationTypeDto>(vm);
            await _operationTypeRepo.Delete(toDelete.Id);

            return(RedirectToAction("Index"));
        }
コード例 #2
0
        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();
        }