public ActionResult EditAccount()
 {
     Person target = libRepo.LibrarianRepo.ListWhere(librarian => librarian.UserName == HttpContext.User.Identity.Name.ToString().Substring(2)).SingleOrDefault();
     if (target == null)
         target = libRepo.MemberRepo.ListWhere(member => member.UserName == HttpContext.User.Identity.Name.ToString().Substring(2)).SingleOrDefault();
     AccountEditor editor = new AccountEditor();
     editor.Name = target.Name;
     editor.Email = target.Email;
     return View(editor);
 }
 public ActionResult EditAccount(AccountEditor editor)
 {
     if (ModelState.IsValid)
     {
         string userName = HttpContext.User.Identity.Name.ToString().Substring(2);
         if ((libRepo.MemberRepo.ListWhere(targetusr => targetusr.Email.ToLower() == editor.Email.ToLower() && targetusr.UserName.ToLower() != userName.ToLower()).SingleOrDefault() == null) &&
            (libRepo.LibrarianRepo.ListWhere(targetusr => targetusr.Email.ToLower() == editor.Email.ToLower() && targetusr.UserName.ToLower() != userName.ToLower()).SingleOrDefault() == null))
         {
             Person target = libRepo.LibrarianRepo.ListWhere(librarian => librarian.UserName == userName).SingleOrDefault();
             if (target == null)
             {
                 target = libRepo.MemberRepo.ListWhere(member => member.UserName == userName).SingleOrDefault();
             }
             target.Name = editor.Name;
             target.Email = editor.Email;
             if (target.Identify().StartsWith("Librarian"))
                 libRepo.LibrarianRepo.Update((Librarian)target);
             else
                 libRepo.MemberRepo.Update((Member)target);
             libRepo.Save();
             TempData["SuccessNoti"] = "Edit account successfully.";
             return RedirectToAction("Index");
         }
         else
         {
             TempData["ErrorNoti"] = "This e-mail is already exists.";
             return View(editor);
         }
     }
     return View(editor);
 }