public async Task <IActionResult> PutHistoryProduct(int id, HistoryProduct historyProduct)
        {
            if (id != historyProduct.hisproid)
            {
                return(BadRequest());
            }

            _context.Entry(historyProduct).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HistoryProductExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        //public async Task<ActionResult<HistoryProduct>> PostHistoryProduct(HistoryProduct historyProduct)
        public async Task <outputScanQr> PostHistoryProduct(paramScanQr pr)
        {
            //_context.HistoryProduct.Add(historyProduct);
            //await _context.SaveChangesAsync();

            outputScanQr output = new outputScanQr();
            var          result = new resultScanQr();

            try
            {
                HistoryProduct dtPrd = new HistoryProduct();
                dtPrd.hisproid  = pr.hisproid;
                dtPrd.productid = pr.productid;
                dtPrd.userid    = pr.userid;
                dtPrd.scantime  = pr.scantime;

                _context.HistoryProduct.Add(dtPrd);
                _context.SaveChanges();

                var dtlogin = (from x in _context.HistoryProduct.Where(ahha => ahha.productid == pr.productid)
                               join prd in _context.Product on x.productid equals prd.productid
                               //where x.productid == pr.productid
                               //orderby x.commentid descending
                               select new Product
                {
                    productid = prd.productid,
                    productname = prd.productname,
                    productdetail = prd.productdetail,
                    productcode = prd.productcode,
                    bannerproduct = prd.bannerproduct,
                    linkstring = prd.linkstring
                }).ToList();

                if (dtlogin != null)
                {
                    //result = dtlogin;

                    output.Result   = "OK";
                    output.products = dtlogin;
                    output.Message  = "Success";
                }
                else
                {
                    output.Result  = "NG";
                    output.Message = "GagalBosque";
                }
            }
            catch (Exception ex)
            {
                output.Result  = "NG";
                output.Message = ex.ToString();
            }

            return(output);
        }