Ejemplo n.º 1
0
 public ActionResult SignUp(UserViewModel userViewModel)
 {
     if (ModelState.IsValid)
     {
         userViewModel.UserType = "Customer";
         User user = AutoMapper.Mapper.Map <UserViewModel, User>(userViewModel);
         if (userViewModel.PromoCode != null)
         {
             bool check = userDetails.CheckPromoCode(user, userViewModel.PromoCode);
             if (check == true)
             {
                 userViewModel.AccountBalance += 50;
             }
             else
             {
                 TempData["alertMessage"] = "Invalid PromoCode";
                 return(RedirectToAction("SignIn", "User"));
             }
         }
         userDetails.SignUp(user);                                                       //Adding Customer Detials To database
         TempData["alertMessage"] = "Registered successfully";
         return(RedirectToAction("SignIn", "User"));
     }
     return(View());
 }