예제 #1
0
        public void Delete(int id)
        {
            _vendorService.Delete(id);
            var unitOfWork = new UnitOfWork(_vendorRepository.SCMSContext);

            unitOfWork.Complete();
        }
예제 #2
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <IVendorRepository>();
            var model = new ApiVendorRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new VendorService(mock.LoggerMock.Object,
                                            mock.RepositoryMock.Object,
                                            mock.ModelValidatorMockFactory.VendorModelValidatorMock.Object,
                                            mock.BOLMapperMockFactory.BOLVendorMapperMock,
                                            mock.DALMapperMockFactory.DALVendorMapperMock,
                                            mock.BOLMapperMockFactory.BOLProductVendorMapperMock,
                                            mock.DALMapperMockFactory.DALProductVendorMapperMock,
                                            mock.BOLMapperMockFactory.BOLPurchaseOrderHeaderMapperMock,
                                            mock.DALMapperMockFactory.DALPurchaseOrderHeaderMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.VendorModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
        }
예제 #3
0
 public ActionResult Delete(int vendorId)
 {
     try
     {
         vendorService.Delete(vendorId);
         var responseModel = new ResponseModel
         {
             StatusCode = (int)HttpStatusCode.OK,
             MessageAr  = AppResource.DeletedSuccessfully
         };
         return(Json(responseModel, JsonRequestBehavior.AllowGet));
     }
     catch (System.Exception)
     {
         var responseModel = new ResponseModel
         {
             StatusCode = (int)HttpStatusCode.OK,
             MessageAr  = AppResource.DeleteErrorValidation
         };
         return(Json(responseModel, JsonRequestBehavior.AllowGet));
     }
 }