Skip to content

Instantly share code, notes, and snippets.

@pkuderov
Last active August 29, 2015 14:06
Show Gist options
  • Save pkuderov/fedd201fd92c3aa3827b to your computer and use it in GitHub Desktop.
Save pkuderov/fedd201fd92c3aa3827b to your computer and use it in GitHub Desktop.
UpdateConfiguration
public async Task<ActionResult> UpdateConfiguration(string login, string password)
{
if (String.IsNullOrWhiteSpace(login) || String.IsNullOrWhiteSpace(password))
return RedirectToAction("Index");
var currentUserId = CurrentUserId;
var siteAccount = await SharedDbContext.SiteAccounts
.FirstOrDefaultAsync(sa => sa.OwnerId == currentUserId && sa.AccountType == SiteAccountType.Responses);
if (siteAccount == null)
return RedirectToAction("Index");
siteAccount.Login = login;
siteAccount.Password = password;
await SharedDbContext.SaveChangesAsync();
return RedirectToAction("Index");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment