// POST api/<controller>
        public async Task <IList <ItemModel> > Post(SearchItemViewModel value)
        {
            NHibernateItemStore his = new NHibernateItemStore();
            var search = await his.SearchItemAsync(value.searchItem);

            return(search);
        }
        // POST api/<controller>
        public async Task Post(PrLinesViewModel value)
        {
            var nh   = new NHibernateUserStore();
            var nhps = new NHibernatePRStore();
            var nhcs = new NHibernateNonCatalogStore();
            var user = nh.FindByStampAsync(value.SecurityStamp);

            if (user != null)
            {
                var       nhis = new NHibernateItemStore();
                ItemModel item = null;
                NonCatalogItemHeadModel nonCatalog = null;
                if (value.itemType == "Catalog")
                {
                    item = await nhis.FindItemByIdAsync(value.Id);
                }
                else
                {
                    nonCatalog = await nhcs.GetNonCatalogAsync(value.Id);
                }
                var PrLines = new PRLinesModel {
                    Item       = item,
                    NonCatalog = nonCatalog,
                    Quantity   = value.Quantity,
                    CreatedBy  = user.Result
                };
                try {
                    await nhps.CreatePRLinesAsync(PrLines);
                } catch (Exception e) {
                    var a = e.Message;
                }
            }
        }
Exemplo n.º 3
0
        public async Task <ActionResult> ItemSearch(SearchItemViewModel value)
        {
            var his = new NHibernateItemStore();

            value.searchItem = value.searchItem ?? "";
            var search = await his.SearchItemAsync(value.searchItem);

            ViewData["ItemImagePath"] = Config.GetAppSetting("ItemImagePath");
            return(PartialView(search));
        }
        // GET: ItemMaintenance
        public async Task <ActionResult> AddItems()
        {
            var branditems    = new NHibernateItemStore();
            var suppliernames = new NHibernateISupplierStore();

            ViewData["BrandItems"] = await branditems.GetAllBrandNameAsync();

            ViewData["SupplierNames"] = await suppliernames.GeatAllSupplierAsync();

            return(View());
        }