public int AddProduct(Product product)
        {
            try
            {
                var dbproduct = new DbProduct()
                {
                    categoryid = product.Categoryid,
                    date_modified = DateTime.Now,
                    description = product.Description,
                    header = product.Header,
                    image = product.Image,
                    imagename = product.Imagename,
                    productname = product.Productname,
                    quantity = product.Quantity,
                    subtract = 0,
                    sort_order = product.SortOrder,
                    shortdesc = product.Shortdesc,
                    status = product.Status,
                    unitprice = product.Unitprice
                };

                dbproduct = _dbEntities.Products.Add(dbproduct);
                _dbEntities.SaveChanges();

                return dbproduct.productid;
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public void UpdateProduct(Product product)
        {
            var dbproduct = _dbEntities.Products.SingleOrDefault(x => x.productid == product.Productid);

            if (dbproduct == null)
            {
                throw new ObjectNotFoundException(string.Format(" Product Id of :{0} was not found", product.Productid));
            }

            try
            {
                dbproduct.categoryid = product.Categoryid;
                dbproduct.date_modified = DateTime.Now;
                dbproduct.description = product.Description;
                dbproduct.header = product.Header;
                dbproduct.image = product.Image;
                dbproduct.imagename = product.Imagename;
                dbproduct.productname = product.Productname;
                dbproduct.quantity = product.Quantity;
                dbproduct.subtract = product.Subtract;
                dbproduct.sort_order = product.SortOrder;
                dbproduct.shortdesc = product.Shortdesc;
                dbproduct.status = product.Status;
                dbproduct.unitprice = product.Unitprice;

                _dbEntities.SaveChanges();

            }
            catch (Exception)
            {

                throw;
            }
        }