Пример #1
0
        public ActionResult Index()
        {
            int userId = ((Identity) HttpContext.User.Identity).UserId;
            var accounts = AccountService.GetActiveAccounts(userId);

            UserMenuModel model = new UserMenuModel
                {
                    Accounts = accounts.Select(a => new UserMenuModel.AccountItem()
                        {
                            AccountId = a.Object1.Id,
                            AccountLogin = a.Object1.AccountLogin,
                            AccountServer = a.Object1.AccountServer,
                            StorageId = a.Object1.StorageId,
                            StorageName = StorageService.GetStoragePlugin(a.Object2.Id).Name
                        }),

                    UserId = userId
                };

            return View(model);
        }
Пример #2
0
        public ActionResult List()
        {
            List<UserStorageModel> storages = new List<UserStorageModel>();
            List<UserMenuModel> accounts = new List<UserMenuModel>();
            for (int i =1;i<=5;i++)
            {
                UserStorageModel smodel = new UserStorageModel
                    {
                        Id = i,
                        Name = "storage name",
                        ImagePath = "/Content/img1"
                    };
                for (int j = 1; j <= 3; j++)
                {
                    UserMenuModel amodel = new UserMenuModel
                        {
                            //StorageId = i,
                            //AccountLogin = "******",
                            //FreeSpace = "2 Gb",
                            //TotalSpace = "5 Gb",
                            //Id = i,
                            //UsedSpace = "3 Gb"
                        };
                    accounts.Add(amodel);

                }
                storages.Add(smodel);
            }
            UserStorageListModel model = new UserStorageListModel
                {
                    UserStorages = storages,
                    UserAccounts = accounts
                };

            return Json(model, JsonRequestBehavior.AllowGet);
        }