コード例 #1
0
        public async Task <JsonResult> GetStocks(int?whouse)
        {
            var user = await userRepo.GetByLogin(User.Identity.Name);

            var shops  = shopService.GetStocks(user);
            int shopId = shops.FirstOrDefault().id;

            if (whouse != null)
            {
                if (shops.Select(p => p.id).Contains(whouse.Value))
                {
                    shopId = whouse.Value;
                }
            }

            var stocks = await _service.GetStocksAsync(shopId, user);

            Response.ContentType = "application/json";
            return(Json(stocks));
        }