Esempio n. 1
0
        public async Task <bool> UpdateEmail(EmailUpdateMessage emailUpdateMessage)
        {
            var findUser = _unitOfWork.Users.FindAsync(x => x.Id == emailUpdateMessage.UserId).Result.FirstOrDefault();

            if (findUser == null)
            {
                return(false);
            }
            findUser.AccountDB.Email = emailUpdateMessage.Email;
            await _context.SaveChangesAsync();

            return(true);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="emailUpdateMessage"></param>
        /// <returns>bool?</returns>
        public bool?UserUpdateEmail(EmailUpdateMessage emailUpdateMessage)
        {
            // verify the required parameter 'emailUpdateMessage' is set
            if (emailUpdateMessage == null)
            {
                throw new ApiException(400, "Missing required parameter 'emailUpdateMessage' when calling UserUpdateEmail");
            }


            var path = "/api/users/email";

            path = path.Replace("{format}", "json");

            var    queryParams  = new Dictionary <String, String>();
            var    headerParams = new Dictionary <String, String>();
            var    formParams   = new Dictionary <String, String>();
            var    fileParams   = new Dictionary <String, FileParameter>();
            String postBody     = null;

            postBody = ApiClient.Serialize(emailUpdateMessage);                                     // http body (model) parameter

            // authentication setting, if any
            String[] authSettings = new String[] {  };

            // make the HTTP request
            IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);

            if (((int)response.StatusCode) >= 400)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UserUpdateEmail: " + response.Content, response.Content);
            }
            else if (((int)response.StatusCode) == 0)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UserUpdateEmail: " + response.ErrorMessage, response.ErrorMessage);
            }

            return((bool?)ApiClient.Deserialize(response.Content, typeof(bool?), response.Headers));
        }
Esempio n. 3
0
        public async Task <IActionResult> UpdateEmail([FromBody] EmailUpdateMessage emailUpdateMessage)
        {
            var result = await _service.UpdateEmail(emailUpdateMessage);

            return(Ok(result));
        }