Exemplo n.º 1
0
        public ActionResult UserDetail(AdminUserIndexModel model)
        {
            List<string> shownManager = new List<string>();
            string accountManagerConfig = ConfigurationManager.AppSettings["ACCOUNT_MANAGERS"];
            if (!string.IsNullOrEmpty(accountManagerConfig))
                shownManager.AddRange(accountManagerConfig.Split(','));

            int userId = 0;
            if (Request.Url != null && Request.Url.Segments.Count() > 3 && !string.IsNullOrEmpty(Request.Url.Segments[3]))
            {
                Int32.TryParse(Request.Url.Segments[3], out userId);
            }

            var api = GoPlayApi.Instance;
            model.user = api.GetUserById(userId).Data;
            if (model.user != null)
            {
                if (!string.IsNullOrEmpty(model.accountManagerNote) && CurrentUser.GetRoles().Any(r => r.RoleName == GoPlayConstantValues.S_ROLE_CUSTOMER_SUPPORT))
                {
                    api.UpdateCustomerAccount(model.user.id, model.accountManager, model.accountManagerNote);
                }
                model.transactions = api.GetTransactions(userId).Data;
                model.account_managers = shownManager;
                model.GetLogs(userId);

                return View(model);
            }

            this.Flash("Account not found", FlashLevel.Alert);
            return Redirect("/admin/user");
        }
Exemplo n.º 2
0
        public ActionResult UserName(string username)
        {
            List<string> shownManager = new List<string>();
            string accountManagerConfig = ConfigurationManager.AppSettings["ACCOUNT_MANAGERS"];
            if (!string.IsNullOrEmpty(accountManagerConfig))
                shownManager.AddRange(accountManagerConfig.Split(','));

            var api = GoPlayApi.Instance;
            var user = api.GetUserByUserName(username).Data;

            if (user == null)
            {
                this.Flash("Account not found", FlashLevel.Alert);
                return Redirect("/admin/user");
            }
            var model = new AdminUserIndexModel
            {
                user = user,
                account_managers = shownManager,
            };
            model.transactions = api.GetTransactions(user.id).Data;
            model.accountManagerNote = !string.IsNullOrEmpty(model.accountManagerNote) ? model.accountManagerNote : "Account Manager Note";
            model.GetLogs(user.id);

            return View("UserDetail", model);
        }