Question: My question might be a little unclear. Same questions were also asked before but I couldn't figure out how to solve mine by reading them. I need more clear guidance:

I have already created three functions to check colors. (I don't have issues with them. I am not including them here because of the size.)
Lets assume we have three working functions like that:

```
function checkHex(input) {
  // returns boolean value if input is hex color
}
checkHex("#1234a6"); // returns true

function checkRGB(input) {
  // returns boolean value if input is RGB color
}
checkRGB("rgb(255, 255, 112)"); // returns true

function checkHSL(input) {
  // returns boolean value if input is hsl color
}
checkHSL("hsl(122, 1, 1)"); // returns true

```

I am having 4th function (checkColor) which has mixed color values to check: 

```
function checkColor(input) {
    // returns boolean value if input belong to right color value 
}

checkColor("#ccccff"); // should return true
checkColor("rgb(255,255,200)"); // should return true
checkColor("hls(46,0.66,0.21)"); // should return true

```

QUESTION: Do I have to include all three functions(checkHex,checkRGB,checkHSL) into the 4th one (checkColor)? How do I do that. I researched about that and tried couple ways to solve but I couldn't.  

 I am trying to do it without using RegExp. I am new to programming, never merged multiple functions before.   

Any additional resource you can share with me about "combining multiple functions" will help me a lot too.  

Thank you for your time and effort in advance !

Answer: 
Linq (and Entity Framework) doesn't have a way to modify objects in a collection. You need to gather the objects to modify, modify them, then trigger EF to save the data back to the database.

```
// get the objects you want to modify
var users = context.Users.Where(x => x.Username == myUsername);

foreach (var user in users)
{
    // change the properties
    user.Bonus += bonusToAdd;
    user.Score += scoreToAdd;
}

// EF will pick up those changes and save back to the database.
context.SaveChanges();

```

---

Of course, `Username` is most likely a primary key, so you shouldn't have more than one `User` record with that name. Simply replace the query and foreach with:

```
var user = context.Users.Single(x => x.Username == myUsername);
user.Bonus += bonusToAdd;
user.Score += scoreToAdd;

```

You can use `SingleOrDefault` to help out with exceptions if you attempt to lookup a user which doesn't exist.
the update keyword isn't used in Linq. You can perform updates as follows:

```
var users = (from p in Context.Users
             where p.Username == username
             select p).ToList().ForEach(x =>
             {
                 x.Score += score;
                 x.Bonus += bonus;
             });
Context.SaveChanges();

```

Or, if you'd prefer not to use lambda expressions, this would work the same:

```
var users = (from p in Context.Users
             where p.Username == username
             select p).SingleOrDefault();

foreach (var user in users)
{
    user.Score += score;
    user.Bonus += bonus;
}           

Context.SaveChanges();

```