Esempio n. 1
0
        public ItemSearchGeneralResponseModel ItemBySimpleSearch(ItemSimpleSearchModel item)
        {
            ItemSearchResultModel          singleItem = new ItemSearchResultModel();
            ItemSearchGeneralResponseModel result     = new ItemSearchGeneralResponseModel();

            result.SearchResult = new List <ItemSearchResultModel>();

            var query      = _itemDataAccess.SimpleSearchItems(item.ItemName, (item.NextBatch - 1) * 10);
            var codeDetail = _itemDataAccess.GetAllItemStatus();

            result.RecordCount = query.RecordCount;

            for (int i = 0; i < query.SearchResult.Count; i++)
            {
                singleItem.Id       = query.SearchResult[i].Id;
                singleItem.ItemName = query.SearchResult[i].ItemName;
                singleItem.Brand    = query.SearchResult[i].Brand;
                singleItem.Status   = codeDetail.Where(x => x.Id == query.SearchResult[i].Status)
                                      .Select(x => x.CodeValue).FirstOrDefault();
                singleItem.CreateDttm   = query.SearchResult[i].CreateDttm;
                singleItem.LocationName = query.SearchResult[i].LocationName;
                singleItem.StocksLeft   = query.SearchResult[i].StockLeft;
                singleItem.Notes        = query.SearchResult[i].Notes;

                result.SearchResult.Add(singleItem);
                singleItem = new ItemSearchResultModel();
            }

            return(result);
        }
Esempio n. 2
0
        public IHttpActionResult ItemsBySimpleSearch([FromBody] ItemSimpleSearchModel item)
        {
            var container = ContainerConfig.Configure();

            using (var scope = container.BeginLifetimeScope())
            {
                var app = scope.Resolve <IItemBusinessLayer>();

                var result = app.ItemBySimpleSearch(item);

                return(Json(result));
            }
        }