예제 #1
0
        public async Task <IActionResult> Delete(long id)
        {
            var provider = await providerRepo.WithId(id);

            await providerRepo.Delete(provider);

            return(new OkObjectResult(provider));
        }
예제 #2
0
        public void Delete_Success_ReturnNull()
        {
            // Arrange
            var repository = new ProviderRepository();
            var input      = repository.Create(GenerateInput());

            // Act
            repository.Delete(input.Id);
            var result = repository.Get(input.Id);

            // Assert
            Assert.IsNull(result);
        }
예제 #3
0
        void IUnitOfWork.Delete(AbstractDomainModel domainModel)
        {
            staff = (Staff)domainModel;
            try
            {
                switch (staff.OperationType)
                {
                case 17:
                    providerRepository.Delete(staff.RemoveProviderId);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        public void DeleteProvider(int ProviderId)
        {
            var Provider = ProviderRepository.GetById(ProviderId);

            ProviderRepository.Delete(Provider);
        }
예제 #5
0
 public bool DeleteProvider(Provider provider)
 {
     return(_providerRepository.Delete(provider.Id));
 }
예제 #6
0
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            DataGridViewRow selectedRow = new DataGridViewRow();
            int             idToDelete;

            try
            {
                selectedRow = DgvGeneric.SelectedRows[0];
                idToDelete  = int.Parse(selectedRow.Cells[0].Value.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }


            switch (activeGrid)
            {
            case 0:
                if (idToDelete == employeeRepo.Get(idToDelete).Id)
                {
                    employeeRepo.Delete(idToDelete);
                    ShowDeletedMessage(sender, e);
                }
                break;

            case 1:
                if (idToDelete == departmentRepo.Get(idToDelete).Id)
                {
                    departmentRepo.Delete(idToDelete);
                    ShowDeletedMessage(sender, e);
                }
                break;

            case 2:
                if (idToDelete == itemRepo.Get(idToDelete).Id)
                {
                    itemRepo.Delete(idToDelete);
                    ShowDeletedMessage(sender, e);
                }
                break;

            case 3:
                if (idToDelete == brandRepo.Get(idToDelete).Id)
                {
                    brandRepo.Delete(idToDelete);
                    ShowDeletedMessage(sender, e);
                }
                break;

            case 4:
                if (idToDelete == unitRepo.Get(idToDelete).Id)
                {
                    unitRepo.Delete(idToDelete);
                    ShowDeletedMessage(sender, e);
                }
                break;

            case 5:
                if (idToDelete == providerRepo.Get(idToDelete).Id)
                {
                    providerRepo.Delete(idToDelete);
                    ShowDeletedMessage(sender, e);
                }
                break;

            case 6:
                // if (idToDelete == requestRepo.Get(idToDelete).Id)
                // {
                //     requestRepo.Delete(idToDelete);
                //     ShowDeletedMessage(sender, e);
                // }
                break;

            case 7:
                // if (idToDelete == orderRepo.Get(idToDelete).Id)
                // {
                //     orderRepo.Delete(idToDelete);
                //     ShowDeletedMessage(sender, e);
                // }
                break;

            case 8:
                if (idToDelete == userRepo.Get(idToDelete).Id)
                {
                    userRepo.Delete(idToDelete);
                    ShowDeletedMessage(sender, e);
                }
                break;
            }
        }
 public void Delete(int id)
 {
     _repository.Delete(id);
 }