コード例 #1
0
        public async Task ShouldCallTheDeleteByCnpj_WhenACpnjIsInformed()
        {
            ProviderService service = CreateServiceMock();

            var document = "29.426.891/0001-24";
            var result   = await service.Delete(document);

            _repositoryMock.Verify(repo => repo.DeleteByCnpj(It.IsAny <string>()), Times.Once());
        }
コード例 #2
0
        public ActionResult Delete(int proId)
        {
            //Provider provider = dbContext.Provider.Find(proId);
            Provider provider = providerService.GetEntities(p => p.Id == proId).FirstOrDefault();

            //dbContext.Entry(provider).State = System.Data.Entity.EntityState.Deleted;
            providerService.Delete(provider);
            //dbContext.SaveChanges();
            providerService.DbSession.SaveChanges <DataModelContainer>();
            return(RedirectToAction("Index", new { pageIndex = Session["pageIndex"] }));
        }
コード例 #3
0
        public async Task <IActionResult> Delete(string id)
        {
            if (Request.Headers["Role"] != "Admin")
            {
                return(BadRequest());
            }

            await _providerService.Delete(id);

            return(Ok());
        }
        public ActionResult Delete(string id)
        {
            var provider = service.Get(id);

            if (provider is null)
            {
                return(NotFound());
            }

            service.Delete(provider);
            return(Ok(new { Success = true, Message = "", data = id }));
        }
コード例 #5
0
        private async Task deleteProvider()
        {
            IsBusy = true;
            if (SelectedProvider != null)
            {
                var service  = new ProviderService(_configuration);
                var response = await service.Delete(SelectedProvider.Id);

                if (response != null)
                {
                    this._providersSource.Remove(response);
                }
            }
            IsBusy = false;
        }
コード例 #6
0
        public async Task <IActionResult> Delete(string providerId)
        {
            var apiRep = new APIResponse();

            if (!(await _providerService.IsExisting(providerId)))
            {
                apiRep.Data  = null;
                apiRep.Error = false;

                return(Ok(apiRep));
            }

            var p = await _providerService.Delete(providerId);

            apiRep.Data  = p;
            apiRep.Error = false;

            return(Ok(apiRep));
        }