public async Task<ActionResult> Edit(UpdateAccount account) { if(ModelState.IsValid) { var model = Service.Create(HttpContext.Items["StorageId"]); var result = await model.AccountManager.Update(account.TheAccount).ToTask(); model.Release(); return View(account); } return RedirectToAction("Index"); }
public async Task<ActionResult> Edit(string accountid) { Guid accountId; if(Guid.TryParse(accountid, out accountId) == false) { return RedirectToAction("Index"); } var model = Service.Create(HttpContext.Items["StorageId"]); var result = await model.AccountFinder.FindAccountById(accountId).ToTask(); model.Release(); if(result.Guid != Guid.Empty) { var updateAccount = new UpdateAccount(); updateAccount.TheAccount = result; return View(updateAccount); } return RedirectToAction("Index"); }