public UserEmergencyContacts[] ReadUserEmergencyContactsByAnyParameter(string _parameterName, string _parameterData)
        {
            FarmworkersWebAPI.Models.User _userControllerInstance = new FarmworkersWebAPI.Models.User();

            DataTable _listOfUsersEmergencyContactsFromDatabase = _userControllerInstance.SearchEmergencyContactsByAnyParameter(_parameterName, _parameterData);

            UserEmergencyContacts[] _listOfUsersEmergencyContacts = new UserEmergencyContacts[_listOfUsersEmergencyContactsFromDatabase.Rows.Count];

            int _userEmergencyContactCounter = 0;

            foreach (DataRow _userRow in _listOfUsersEmergencyContactsFromDatabase.Rows)
            {
                UserEmergencyContacts _userEmergencyContact = new UserEmergencyContacts
                {
                    UserID = int.Parse(_userRow["UserID"].ToString()),
                    UserEmergencyContactsID          = int.Parse(_userRow["UserEmergencyContactsID"].ToString()),
                    UserEmergencyContactsName        = _userRow["UserEmergencyContactsName"].ToString(),
                    UserEmergencyContactsPhoneNumber = _userRow["UserEmergencyContactsPhoneNumber"].ToString(),
                    UserEmergencyContactsAddress     = _userRow["UserEmergencyContactsAddress"].ToString()
                };

                _listOfUsersEmergencyContacts[_userEmergencyContactCounter] = _userEmergencyContact;

                _userEmergencyContactCounter++;
            }

            return(_listOfUsersEmergencyContacts);
        }
        public bool DeleteUserEmergencyContact(string _userEmergencyContactID, string _userID)
        {
            FarmworkersWebAPI.Models.User _userControllerInstance = new FarmworkersWebAPI.Models.User();

            bool _deleteUserResult = _userControllerInstance.DeleteUserEmergencyContact(_userEmergencyContactID, _userID);

            return(_deleteUserResult);
        }
        public IHttpActionResult UpdateUserEmergencyContact(UserEmergencyContacts _userEmergencyContactInformation)
        {
            FarmworkersWebAPI.Models.User _userReceived = new FarmworkersWebAPI.Models.User();

            _userReceived.UpdateUserEmergencyContactModel(_userEmergencyContactInformation);

            return(Ok(_userReceived.UpdateUserEmergencyContactModel(_userEmergencyContactInformation)));
        }
        public bool DeleteByUserAnyParameter(string _parameterName, string _parameterData, string _exactMatch)
        {
            FarmworkersWebAPI.Models.User _userControllerInstance = new FarmworkersWebAPI.Models.User();

            bool _deleteUserResult = _userControllerInstance.DeleteUserByAnyParameter(_parameterName, _parameterData, _exactMatch);

            return(_deleteUserResult);
        }
        public IHttpActionResult UpdateUser(FarmworkersWebAPI.Models.User _userInformation)
        {
            FarmworkersWebAPI.Models.User _userReceived = new FarmworkersWebAPI.Models.User();

            _userReceived.UpdateUserFromFarm(_userInformation);

            return(Ok(_userReceived.InsertUserModel(_userInformation)));
        }
        public FarmworkersWebAPI.Models.User[] ReadUserAnyParameter(string _parameterName, string _parameterData)
        {
            FarmworkersWebAPI.Models.User _userControllerInstance = new FarmworkersWebAPI.Models.User();

            DataTable _listOfUsersFromDatabase = _userControllerInstance.SearchActiveUserByAnyParameter(_parameterName, _parameterData);

            FarmworkersWebAPI.Models.User[] _listOfUsers = new FarmworkersWebAPI.Models.User[_listOfUsersFromDatabase.Rows.Count];

            int _userCounter = 0;

            foreach (DataRow _userRow in _listOfUsersFromDatabase.Rows)
            {
                FarmworkersWebAPI.Models.User _user = new FarmworkersWebAPI.Models.User
                {
                    UserID           = int.Parse(_userRow["UserID"].ToString()),
                    UserType         = _userRow["UserType"].ToString(),
                    UserName         = _userRow["UserName"].ToString(),
                    UserLastName     = _userRow["UserLastName"].ToString(),
                    UserDateOfBirth  = _userRow["UserDateOfBirth"].ToString(),
                    UserWeight       = int.Parse(_userRow["UserWeight"].ToString()),
                    UserHeight       = _userRow["UserHeight"].ToString(),
                    UserGender       = _userRow["UserGender"].ToString(),
                    UserEmail        = _userRow["UserEmail"].ToString(),
                    UserPhoneNumber  = _userRow["UserPhoneNumber"].ToString(),
                    UserWorkLocation = _userRow["UserWorkLocation"].ToString(),
                    UserMemberSince  = _userRow["UserMemberSince"].ToString(),
                    IsActive         = _userRow["IsActive"].ToString(),
                    UserFarmID       = _userRow["FarmID"].ToString(),
                };

                _listOfUsers[_userCounter] = _user;

                _userCounter++;
            }

            return(_listOfUsers);
        }