Beispiel #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());
        }
        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"] }));
        }
Beispiel #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 }));
        }
Beispiel #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;
        }
        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));
        }