public ActionResult Index()
 {
     if (authController.IsUserLoggedIn(Request, Response))
     {
         ViewBag.user   = authController.GetUserLoggedUser(Request);
         ViewBag.userId = new AuthController().GetUserIdByCookie(Request.Cookies["auth"]);
         return(View("Index"));
     }
     return(Redirect("~/Auth/Login"));
 }
 public ActionResult Edit(int userId)
 {
     if (authController.IsUserLoggedIn(Request, Response))
     {
         ViewBag.user = new UserServiceReference.UserServiceClient().GetUserByCookie(Request.Cookies["auth"].Value);
         ViewBag.zips = zipServiceClient.GetAllZips();
         try
         {
             if (userId == userServiceClient.GetUserByCookie(Request.Cookies["auth"].Value).Id)
             {
                 var user = userServiceClient.GetUserById(userId);
                 ViewBag.userId        = userId;
                 ViewBag.selectedZipId = user.ZipId.ToString();
                 ViewBag.username      = user.Username;
                 ViewBag.name          = user.Name;
                 ViewBag.birthday      = user.DateOfBirth.ToString();
                 ViewBag.phone         = user.Phone;
                 ViewBag.email         = user.Email;
                 ViewBag.address       = user.Address;
                 ViewBag.gender        = user.Gender == UserServiceReference.Gender.Female ? 1.ToString() : 0.ToString();
             }
             else
             {
                 ViewBag.MassError = "You have no access to this user details!";
             }
         }
         catch (Exception e)
         {
             ViewBag.massError = "Internal server error has ocurred please try again after 5 minutes";
             ViewBag.MassError = e.Message;
         }
         return(View("Edit"));
     }
     else
     {
         return(Redirect("~/Auth/Login"));
     }
 }
Esempio n. 3
0
        public ActionResult Index()
        {
            if (authController.IsUserLoggedIn(Request, Response))
            {
                ViewBag.user     = new UserServiceReference.UserServiceClient().GetUserByCookie(Request.Cookies["auth"].Value);
                ViewBag.userId   = authController.GetUserIdByCookie(Request.Cookies["auth"]);
                ViewBag.products = GetAvailableProductsWithBidPrice();

                return(View("Catalog"));
            }
            else
            {
                return(Redirect("~/Auth/Login"));
            }
        }