public IActionResult Delete([FromODataUri] int phoneNumberTypeId)
        {
            try
            {
                if (!_phoneNumberTypeRepository.PhoneNumberTypeExists(phoneNumberTypeId))
                {
                    return(NotFound());
                }

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

                return(NoContent());
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed in Delete /PhoneNumberTypes(phoneNumberTypeId): {ex}");
                return(StatusCode(500, "A problem happened while handling your request."));
            }
        }
Beispiel #2
0
 public async Task <BaseOutPutDto> DeletePhoneNumberType(int id)
 {
     return(await phoneNumberTypeRepository.DeletePhoneNumberType(id));
 }