Exemplo n.º 1
0
        public async Task <IActionResult> UpdateEmailNotification([FromBody] UserNotification userNotification)
        {
            try
            {
                ProfileDataAccess _profileAccess = new ProfileDataAccess(_iconfiguration);

                DatabaseResponse response = await _profileAccess.UpdateEmailNotification(userNotification);

                if (response.ResponseCode == (int)DbReturnValue.UpdateSuccess)
                {
                    return(Ok(new OperationResponse
                    {
                        HasSucceeded = true,
                        IsDomainValidationErrors = false,
                        Message = EnumExtensions.GetDescription(DbReturnValue.UpdateSuccess),
                        ReturnedObject = response.ResponseCode
                    }));
                }
                else
                {
                    return(Ok(new OperationResponse
                    {
                        HasSucceeded = true,
                        IsDomainValidationErrors = false,
                        Message = EnumExtensions.GetDescription(DbReturnValue.UpdationFailed)
                    }));
                }
            }
            catch (Exception ex)
            {
                Log.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));

                return(Ok(new OperationResponse
                {
                    HasSucceeded = false,
                    Message = StatusMessages.ServerError,
                    StatusCode = ((int)ResponseStatus.ServerError).ToString(),
                    IsDomainValidationErrors = false
                }));
            }
        }