/// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool BuildNewMember(CreateMemberViewModel model)
        {
            var newMember = new Member()
            {
                DisplayName = model.DisplayName,
                Email = model.Email,
                MemberSince = DateTime.Now,
                MemberDetails = new MemberDetails() { MemberSince = DateTime.Now, DisplayName = model.DisplayName }
            };

            try
            {
                UoW.Members.Add(newMember);
                UoW.SaveChanges();
            }
            catch (Exception e)
            {
                TempData["message"] = "Error: " + e.InnerException + "\nError registering user. Please try again,";
                return false;
            }

            TempData["message"] = "Thanks For Registering!!";
            return true;
        }
        public ActionResult Register(CreateMemberViewModel model)
        {
            var help = new AccountControllerHelpers(UoW, PWS);

            if (ModelState.IsValid)
            {
                if (help.BuildNewMember(model))
                {
                    // Attempt to register the member
                    try
                    {
                        WebSecurity.CreateUserAndAccount(model.DisplayName, model.Password);
                        Roles.AddUserToRole(model.DisplayName, "Member");
                        WebSecurity.Login(model.DisplayName, model.Password);
                        return RedirectToAction("Index", "Home");
                    }
                    catch (MembershipCreateUserException e)
                    {
                        ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                    }

                    MigrateShoppingCart(model.DisplayName);
                    MigrateWishList(model.DisplayName);

                    FormsAuthentication.SetAuthCookie(model.DisplayName, false /* createPersistentCookie */);
                    TempData["toast"] = "<script> $(document).ready(function () {" +
                                "toastr.options = { 'positionClass': 'toast-bottom-right' };" +
                                "toastr.success('Thanks for registering!');});</script>";

                    return RedirectToAction("Index", "Home");
                }
            }
            return View("RegisterMember", model);
        }
 public ActionResult Register()
 {
     var model = new CreateMemberViewModel();
     return View("RegisterMember", model);
 }