示例#1
0
        public JsonResult dashbord()
        {
            UnitOfWork        u     = new UnitOfWork();
            DashbordViewModel model = new DashbordViewModel();

            model.CountContact = u.Contact.Get(p => p.Remove == false).Count().ToString();
            model.CountGroup   = u.Group.Get(p => p.Remove == false).Count().ToString();
            model.CountLog     = u.Log.Get().Count().ToString();
            model.CountUser    = u.User.Get(p => p.Remove == false).Count().ToString();
            return(Json(model));
        }
示例#2
0
        public ActionResult Index()
        {
            var dashBoardViewModel = new DashbordViewModel
            {
                Inventories     = _unitOfWork.Inventory.GetAllInventories().OrderBy(x => x.QtyInStock).Take(8),
                PartsWithdrawls = _unitOfWork.PartsWithdrawHistories.GetAllPartsWithdrawl().Take(4),
                PartsPurchases  = _unitOfWork.PartsPurchaseRecords.GetAllPartsPurchaseRecords().Take(4)
            };

            return(View(dashBoardViewModel));
        }
        public async Task <IActionResult> Index()
        {
            TokenRepo.Tokens.TryGetValue(User.Identity.Name, out var t);

            var vm = new DashbordViewModel(new List <ExternalAccount>(), "", "");

            if (!string.IsNullOrEmpty(t.token))
            {
                var client = new HttpClient();
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", t.token);
                var resp = await client.GetFromJsonAsync <List <ExternalAccount> >("http://accounts.api.pursuit.local:5001/api/accounts");

                vm = new DashbordViewModel(resp, t.token, t.payload);
            }

            return(View(vm));
        }