示例#1
0
 public ActionResult ChangePassword(int mid, string cpass, string npass, string rpass)
 {
     if (Convert.ToInt32(Session["userId"]) == mid)
     {
         myPasswordViewModel p = new myPasswordViewModel();
         p.member = _MemberService.GetById(mid);
         if (p.member.Password != cpass)
         {
             return(RedirectToAction("changepass", "UserDashboard", new { id = mid, f = 1 }));
         }
         else if (npass != rpass)
         {
             return(RedirectToAction("changepass", "UserDashboard", new { id = mid, f = 2 }));
         }
         else
         {
             p.member.Password = npass;
             _MemberService.Update(p.member);
             return(RedirectToAction("info", "UserDashboard", new { id = mid }));
         }
     }
     else
     {
         return(RedirectToAction("Index", "UserHome"));
     }
 }
示例#2
0
        public ActionResult changepass(int id, int f)
        {
            if (Convert.ToInt32(Session["userId"]) == id)
            {
                myPasswordViewModel p = new myPasswordViewModel();
                p.MemberId           = id;
                p.Name               = _MemberService.GetById(id).Name;
                p.totalProductInCart = _CartService.GetByMemberId(Convert.ToInt32(Session["userId"])).Count();
                p.member             = _MemberService.GetById(id);
                if (f == 1)
                {
                    p.flag = 1;
                }
                else if (f == 2)
                {
                    p.flag = 2;
                }
                else
                {
                    p.flag = 0;
                }

                return(View(p));
            }
            else
            {
                return(RedirectToAction("Index", "UserHome"));
            }
        }