public void DeleteTest()
        {
            int count    = _memoryDbContext.Containers.Count();
            var entityId = _memoryDbContext.Containers.FirstOrDefault();

            Assert.IsTrue(_wasteContainerService.Delete(entityId.Id));
            Assert.IsTrue(_memoryDbContext.Containers.Count() == count - 1);
        }
Exemplo n.º 2
0
        public IActionResult DeleteConfirmed(Guid id)
        {
            if (id == null)
            {
                return(NotFound().WithError(LOCALIZATION_ERROR_NOT_FOUND));
            }

            try
            {
                _wasteContainerService.Delete(id);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                return(RedirectToAction(nameof(Index)).WithError(ex.Message));
            }

            return(RedirectToAction(nameof(Index)).WithSuccess(LOCALIZATION_SUCCESS_DEFAULT));
        }