public bool Update(Account account) { if (account == null) { return(false); } string command = $@" UPDATE acc SET "; if (!String.IsNullOrWhiteSpace(account.FirstName)) { command += $" acc.acc_first_name = '{account.FirstName}',"; } if (!String.IsNullOrWhiteSpace(account.LastName)) { command += $" acc.acc_last_name = '{account.LastName}',"; } if (!String.IsNullOrWhiteSpace(account.Street)) { command += $" acc.acc_street = '{account.Street}',"; } if (!String.IsNullOrWhiteSpace(account.City)) { command += $" acc.acc_city = '{account.City}',"; } if (!String.IsNullOrWhiteSpace(account.State)) { command += $" acc.acc_state = '{account.State}',"; } if (!String.IsNullOrWhiteSpace(account.Zip)) { command += $" acc.acc_zip = '{account.Zip}',"; } if (account.Role != null) { command += $" acc.acc_role = '{account.Role.Value}',"; } if (account.Degree != null) { command += $" acc.deg_id = '{account.Degree.Id}',"; } if (account.Concentration != null) { command += $" acc.con_id = '{account.Concentration.Id}'"; } command += $@" FROM dbo.tblAccount acc WHERE acc.acc_id = '{account.Id}' "; /** * acc.acc_phone = '{account.Phone}', * acc.acc_role = '{account.Role.Value}', */ DatabaseService service = new DatabaseService(); int rowsAffected = service.Write(command); service.Close(); if (rowsAffected > 0) { return(true); } else { return(false); } }