Example #1
0
        public IActionResult SearchGoods([FromQuery] string searchName)
        {
            var rawGoods = _goodRepository.SearchAllGoodsFromStoreByString(searchName);
            var goods    = new List <GoodsVmOut>();

            foreach (var item in rawGoods)
            {
                var good = new GoodsVmOut()
                {
                    Id          = item.Id,
                    Amount      = item.Amount,
                    Cost        = item.Cost,
                    Description = item.Description,
                    Good_name   = item.Good_name,
                    StoreId     = item.StoreId,
                    Type        = item.Type
                };
                goods.Add(good);
            }

            return(Ok(new { success = true, goods }));
        }
Example #2
0
        public IActionResult GetGoodsFromStoreById([FromQuery] int storeId)
        {
            var rawGoods = _goodRepository.GetAllGoodsFromStoreById(storeId);
            var goods    = new List <GoodsVmOut>();

            foreach (var item in rawGoods)
            {
                var good = new GoodsVmOut()
                {
                    Id          = item.Id,
                    Amount      = item.Amount,
                    Cost        = item.Cost,
                    Description = item.Description,
                    Good_name   = item.Good_name,
                    StoreId     = item.StoreId,
                    Type        = item.Type
                };
                goods.Add(good);
            }

            return(Ok(new { success = true, goods }));
        }