public async Task <userResponse> Get([FromBody] loginRequest request)
        {
            userResponse userResponse  = new userResponse();
            var          credentials   = new Amazon.Runtime.BasicAWSCredentials(Constants.access_key, Constants.secret_key);
            var          tableName     = "users";
            var          S3Client      = new AmazonDynamoDBClient(credentials, Constants.regionEndpoint);
            var          tableResponse = await S3Client.ListTablesAsync();

            if (tableResponse.TableNames.Contains(tableName))
            {
                var conditions = new List <ScanCondition>();
                conditions.Add(new ScanCondition("userName", ScanOperator.Equal, request.username));
                conditions.Add(new ScanCondition("userPassword", ScanOperator.Equal, request.userpassword));
                var allDocs = await _context.ScanAsync <users>(conditions).GetRemainingAsync();

                user _user = new user();
                _user.userEmail      = allDocs[0].userEmail;
                _user.userImageUrl   = allDocs[0].userImageUrl;
                _user.userFirstName  = allDocs[0].userFirstName;
                _user.userId         = allDocs[0].userId;
                _user.userLastName   = allDocs[0].userLastName;
                _user.userName       = allDocs[0].userName;
                _user.userPassword   = allDocs[0].userPassword;
                userResponse.user    = _user;
                userResponse.code    = (int)System.Net.HttpStatusCode.OK;
                userResponse.message = "Success";
                // Create our table if it doesn't exist

                DynamoDBContext context        = new DynamoDBContext(S3Client);
                var             tableResponse1 = await S3Client.ListTablesAsync();

                if (tableResponse1.TableNames.Contains(tableName))
                {
                    var conditions1 = new List <ScanCondition>();
                    conditions.Add(new ScanCondition("userId", ScanOperator.Equal, allDocs[0].userId));
                    var allDocs1 = await context.ScanAsync <users>(conditions1).GetRemainingAsync();

                    users _user1 = new users();
                    _user1.userEmail     = allDocs1[0].userEmail;
                    _user1.userImageUrl  = request.imageUrl;
                    _user1.userFirstName = allDocs1[0].userFirstName;
                    _user1.userId        = allDocs1[0].userId;
                    _user1.userLastName  = allDocs1[0].userLastName;
                    _user1.userName      = allDocs1[0].userName;
                    _user1.userPassword  = allDocs1[0].userPassword;
                    await context.SaveAsync <users>(_user1);
                }
            }

            return(userResponse);
        }
        public async Task <userResponse> getUser([FromRoute] string id)
        {
            ;
            userResponse resUser = new userResponse();

            try
            {
                var             credentials   = new Amazon.Runtime.BasicAWSCredentials(Constants.access_key, Constants.secret_key);
                var             S3Client      = new AmazonDynamoDBClient(credentials, Constants.regionEndpoint);
                var             tableName     = "users";
                DynamoDBContext context       = new DynamoDBContext(S3Client);
                var             tableResponse = await S3Client.ListTablesAsync();

                if (tableResponse.TableNames.Contains(tableName))
                {
                    var conditions = new List <ScanCondition>();
                    conditions.Add(new ScanCondition("userId", ScanOperator.Equal, id));
                    var allDocs = await context.ScanAsync <users>(conditions).GetRemainingAsync();

                    user _user = new user();
                    _user.userEmail     = allDocs[0].userEmail;
                    _user.userImageUrl  = allDocs[0].userImageUrl;
                    _user.userFirstName = allDocs[0].userFirstName;
                    _user.userId        = allDocs[0].userId;
                    _user.userLastName  = allDocs[0].userLastName;
                    _user.userName      = allDocs[0].userName;
                    _user.userPassword  = allDocs[0].userPassword;
                    resUser.user        = _user;
                    resUser.code        = (int)System.Net.HttpStatusCode.OK;
                    resUser.message     = "Success";
                }
            }
            catch (Exception ex)
            {
                resUser.code    = (int)System.Net.HttpStatusCode.BadGateway;
                resUser.message = ex.Message;
            }

            return(resUser);
        }