public ActionResult Edit(int id, FormCollection collection)
 {
     StaffMember sm = _repository.GetStaffMemberById(id);
     if (sm == null)
     {
         return View("StaffMemberNotFound");
     }
     bool needsHash = true;
     if (collection["password_hash"] == null ||
         collection["password_hash"].Trim() == "")
     {
         collection["password_hash"] = sm.password_hash;
         needsHash = false;
     }
     // This will try to update all the fields in the model based on the form collection
     if (TryUpdateModel(sm, collection))
     {
         if (needsHash)
         {
             AccountController ac = new AccountController();
             ac.MembershipService.ChangePassword(sm.auth_name,
                                                 sm.password_hash,
                                                 collection["password_hash"]);
         }
         _repository.Save();
         TempData["Message"] = "Staff Member updated";
         return RedirectToAction("Index");
     }
     return View("Edit", sm);
 }
 private static AccountController GetAccountController()
 {
     AccountController controller = new AccountController(new MockFormsAuthenticationService(), new MockMembershipService());
     controller.ControllerContext = new ControllerContext()
     {
         Controller = controller,
         RequestContext = new RequestContext(new MockHttpContext(), new RouteData())
     };
     return controller;
 }