コード例 #1
0
 public ActionResult UserProfile(UserProfile userProfile)
 {
     try
     {
         if (ModelState.IsValid)
         {
             BTourGuideOp tourOp = new BTourGuideOp();
             string username = User.Identity.Name;
             AUser user = tourOp.GetUser(username);
             user.UserPhone = userProfile.UserChanges.UserPhone;
             user.UserEmail = userProfile.UserChanges.UserEmail;
             tourOp.EditUser(user);
             return RedirectToAction("Index", "Home");
         }
         else
             return View(userProfile);
     }
     catch(Exception e)
     {
         TempData["UserProfileException"] = "" + e.Message;
         return View(userProfile);
     }
 }
コード例 #2
0
 public ActionResult UserProfile(string username, string msg)
 {
     BTourGuideOp tourOp = new BTourGuideOp();
     AUser user = tourOp.GetUser(username);
     List<AReg> userRegs =  tourOp.GetRegistrationsByUserID(user.UserID);
     UserProfile userProfile = new UserProfile();
     UserChanges userChanges = new UserChanges();
     userProfile.UserRegs = userRegs;
     userChanges.UserEmail = user.UserEmail;
     userChanges.UserPhone = user.UserPhone;
     userProfile.UserChanges = userChanges;
     ViewBag.Username = username;
     ViewBag.Msg = msg; // Password change msg
     return View(userProfile);
 }