예제 #1
0
 public ActionResult Edit(AccountEditViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         Login login = _dataService.GetLoginById(viewModel.LoginId);
         if (login.Username != viewModel.UserName &&
             _dataService.GetLoginByUsername(viewModel.UserName) != null)
         {
             ModelState.AddModelError("UserName", "An Account with this username already exists in the database");
         }
         else
         {
             _dataService.UpdateLoginInfo(viewModel.ConvertToEntity(login));
             return(RedirectToAction("Index"));
         }
     }
     return(View(viewModel));
 }