Пример #1
0
 public ActionResult ChangeUsername(Account account, int? userId)
 {
     if (userId.HasValue)
     {
         using (RentItServiceClient proxy = new RentItServiceClient())
         {
             proxy.UpdateUser(userId.Value, account.NewUsername, null, null);
         }
         return Redirect(Request.UrlReferrer.PathAndQuery);
     }
     return RedirectToAction("Index", "Home");
 }
Пример #2
0
 public ActionResult SignUp(Account account)
 {
     using (RentItServiceClient proxy = new RentItServiceClient())
     {
         if (account.NewPassword.Equals(account.ConfirmPassword))
         {
             try
             {
                 User user = proxy.SignUp(account.NewUsername, account.NewEmail, account.NewPassword);
                 Session["userId"] = user.Id;
                 Session["username"] = user.Username;
                 return RedirectToAction("PopularChannels", "Channel", new { userId = user.Id });
             }
             catch (Exception)
             {
             }
         }
         return RedirectToAction("Index", "Home");
     }
 }
Пример #3
0
 public ActionResult Edit(int? userId)
 {
     if (userId.HasValue)
     {
         using (RentItServiceClient proxy = new RentItServiceClient())
         {
             User user = proxy.GetUser(userId.Value);
             if (user != null)
             {
                 Account acc = new Account();
                 acc.UserId = user.Id;
                 acc.CurrentEmail = user.Email;
                 acc.CurrentUsername = user.Username;
                 return View(acc);
             }
         }
     }
     return RedirectToAction("Index", "Home");
 }