public async Task <ActionResult> ChangeRangePrice(int productid, [FromBody] Pricerangemodel model)
        {
            var pro = await _context.Product.SingleOrDefaultAsync(p => p.Productid == productid);

            if (pro == null)
            {
                return(BadRequest("Invalid productid"));
            }
            var pm = await _context.Pricerangemodel.SingleOrDefaultAsync(p => p.Productid == productid);

            if (pm == null)
            {
                return(BadRequest("No price record found for this product"));
            }
            _context.Entry(pm).CurrentValues.SetValues(model);
            await _context.SaveChangesAsync();

            return(Ok());
        }
        public async Task <ActionResult> AddRangePrice(int productid, [FromBody] Pricerangemodel model)
        {
            var pro = await _context.Product.SingleOrDefaultAsync(p => p.Productid == productid);

            if (pro == null)
            {
                return(BadRequest("Invalid productid"));
            }
            if (pro.Pricemodel.ToLower() != "range")
            {
                return(BadRequest("Price model mismatch"));
            }
            var pm = await _context.Pricerangemodel.SingleOrDefaultAsync(p => p.Productid == productid);

            if (pm != null)
            {
                return(BadRequest("There already exist a price value for this product"));
            }
            _context.Pricerangemodel.Add(model);
            await _context.SaveChangesAsync();

            return(Ok());
        }