Пример #1
0
        public IActionResult DeleteAddressType(int Id)
        {
            var addressT = _addTypeRepo.GetAddressType(Id);

            if (addressT == null)
            {
                return(new NotFoundResult());
            }
            else
            {
                _addTypeRepo.DeleteAddressType(Id);
                return(new NoContentResult());
            }
        }
Пример #2
0
        public IActionResult Delete([FromODataUri] int addressTypeId)
        {
            try
            {
                if (!_addressTypeRepository.AddressTypeExists(addressTypeId))
                {
                    return(NotFound());
                }

                var userId  = User.FindFirstValue(ClaimTypes.NameIdentifier);
                var profile = _accountRepository.GetUserProfile(userId);
                if (!_addressTypeRepository.DeleteAddressType(addressTypeId, profile.UserProfileId))
                {
                    return(StatusCode(500, "A problem happened while handling your request."));
                }

                return(NoContent());
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed in Delete /AddressTypes(addressTypeId): {ex}");
                return(StatusCode(500, "A problem happened while handling your request."));
            }
        }