Last active
August 29, 2015 14:01
-
-
Save hagbarddenstore/d25dc2e6bf66bdcd7bea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Update() | |
{ | |
try | |
{ | |
var user = db.Users.SingleOrDefault(x => x.UserId == userId); | |
if (user == null) | |
{ | |
throw new UserNotFoundException(userId); | |
} | |
// TODO: Validate the email address. | |
user.EmailAddress = emailAddress; | |
if (!string.IsNullOrEmpty(password)) | |
{ | |
user.Password = password; | |
} | |
user.StoreId = storeId; | |
user.Role = role; | |
db.SaveChanges(); | |
} | |
catch (InvalidOperationException) | |
{ | |
throw new MultipleUsersFoundException(userId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment