public async Task <IActionResult> UpdateUserAccount(ModelUpdateAccountUser model)
        {
            ModelResponseMessageUpdateUserRegister e = await _IDocMenuFService.UpdateUserAccountAsync(model);

            if (e.Status)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
 public async Task<IActionResult> UpdateUserAccount(ModelUpdateAccountUser model)
 {
     var requestUri = $"{_WebApiModel.BaseURL}/{"PrivateDocMenuF"}/{"UpdateUserAccount"}";
     string authHeader = HttpContext.Request?.Headers["Authorization"];
     if (authHeader != null && authHeader.StartsWith("Bearer"))
     {
         BearerToken = authHeader.Substring("Bearer ".Length).Trim();
     }
     var response = await HttpRequestFactory.Post(requestUri, BearerToken, model);
     switch (response.StatusCode)
     {
         case HttpStatusCode.Unauthorized:
             return Unauthorized(response.ContentAsString());
         case HttpStatusCode.BadRequest:
             return BadRequest(response.ContentAsString());
         case HttpStatusCode.OK:
             return Ok(response.ContentAsString());
         default:
             return StatusCode(500);
     }
 }
Exemplo n.º 3
0
        public async Task <ModelResponseMessageUpdateUserRegister> UpdateUserAccountAsync(ModelUpdateAccountUser model)
        {
            ModelResponseMessageUpdateUserRegister resp = new ModelResponseMessageUpdateUserRegister();

            string userid = Encoding.UTF8.GetString(Convert.FromBase64String(model.registerid));

            using (SqlConnection conn = new SqlConnection(ConnectionString))
            {
                conn.Open();
                using (SqlCommand cmd = new SqlCommand("sp_update_user_account", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add("@RegisterId", SqlDbType.VarChar, 100).Value = userid;
                    cmd.Parameters.Add("@Email", SqlDbType.VarChar, 200).Value      = ParseDataHelper.ConvertDBNull(model.email);
                    cmd.Parameters.Add("@FirstName1", SqlDbType.VarChar, 50).Value  = ParseDataHelper.ConvertDBNull(model.firstname1);
                    cmd.Parameters.Add("@FirstName2", SqlDbType.VarChar, 50).Value  = ParseDataHelper.ConvertDBNull(model.firstname2);
                    cmd.Parameters.Add("@FirstName", SqlDbType.VarChar, 50).Value   = ParseDataHelper.ConvertDBNull(model.firstname);
                    cmd.Parameters.Add("@FullName", SqlDbType.VarChar, 200).Value   = ParseDataHelper.ConvertDBNull(model.fullname);
                    cmd.Parameters.Add("@WorkPhone", SqlDbType.VarChar, 50).Value   = ParseDataHelper.ConvertDBNull(model.workphone);
                    cmd.Parameters.Add("@Mobile", SqlDbType.VarChar, 20).Value      = ParseDataHelper.ConvertDBNull(model.mobile);
                    cmd.Parameters.Add("@Fax", SqlDbType.VarChar, 20).Value         = ParseDataHelper.ConvertDBNull(model.fax);
                    cmd.Parameters.Add("@Position", SqlDbType.VarChar, 2).Value     = model.position;
                    cmd.Parameters.Add("@Faculty", SqlDbType.VarChar, 2).Value      = model.faculty;
                    cmd.Parameters.Add("@Education", SqlDbType.VarChar, 2).Value    = model.education;
                    cmd.Parameters.Add("@Note1", SqlDbType.NVarChar).Value          = ParseDataHelper.ConvertDBNull(model.note1);
                    cmd.Parameters.Add("@Note2", SqlDbType.NVarChar).Value          = ParseDataHelper.ConvertDBNull(model.note2);
                    cmd.Parameters.Add("@Note3", SqlDbType.NVarChar).Value          = ParseDataHelper.ConvertDBNull(model.note3);

                    SqlParameter rStatus = cmd.Parameters.Add("@rStatus", SqlDbType.Int);
                    rStatus.Direction = ParameterDirection.Output;
                    SqlParameter rMessage = cmd.Parameters.Add("@rMessage", SqlDbType.NVarChar, 500);
                    rMessage.Direction = ParameterDirection.Output;

                    await cmd.ExecuteNonQueryAsync();

                    if ((int)cmd.Parameters["@rStatus"].Value > 0)
                    {
                        resp.Status = true;
                    }
                    else
                    {
                        resp.Message = (string)cmd.Parameters["@rMessage"].Value;
                    }
                }
                conn.Close();
            }
            return(resp);
        }
Exemplo n.º 4
0
 public async Task <ModelResponseMessageUpdateUserRegister> UpdateUserAccountAsync(ModelUpdateAccountUser model)
 {
     return(await _IDocMenuF1Repository.UpdateUserAccountAsync(model));
 }