public JsonResult AddGear(NewProductModel model)
        {
            if (!model.ValidOtherBrand())
            {
                ModelState.AddModelError("OtherBrand", "Please enter a new brand");
            }
            if (ModelState.IsValid)
            {

                int id = ProductAddHelper.AddGearProduct(model);

                return Json(String.Format(PathConstants.Pages.ReviewPathWithProductId, "Index", id.ToString()));
            }

            List<string> subcategories = ProductAddHelper.AllGearSubcategories();
            subcategories.Insert(0, "Select");
            ViewBag.Subcategories = new SelectList(subcategories, model.Subcategory);

            List<string> brands = ProductAddHelper.AllBrands("GEAR");
            brands.Insert(0, "Select");
            brands.Insert(brands.Count(), "Other..");
            ViewBag.Brands = new SelectList(brands, model.Brand);

            Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
            return Json(ModelState.Select(x => x.Value.Errors).ToList());
        }
        public static int AddGearProduct(NewProductModel model)
        {
            ///rs
            Data.Product dbProduct = ConvertNewGearToDbProduct(model, "GEAR");
            //int duplicateid = MappingSearch.Data.Accessors.ProductsAccessor.DuplicateProductExists(dbProduct);

            int id = MappingSearch.Data.Accessors.ProductsAccessor.AddNewGearProduct(dbProduct);
            return id;
        }
        private static Data.Product ConvertNewGearToDbProduct(NewProductModel model,string category)
        {
            Data.Product p = new Data.Product();

            p.Approved = false;
            p.Brand = model.Brand;
            p.Category = category;
            p.Title = FormInputHelper.StripInput(model.ProductName);
            p.Description = String.IsNullOrEmpty(model.Description) ? string.Empty : FormInputHelper.StripInput(model.Description);
            p.Image = String.Empty;
            p.SubmittedBy = System.Web.HttpContext.Current.User.Identity.Name;
            decimal x;
            Decimal.TryParse(model.Price,out x);
            p.MSRP = x;

            p.SubCategory = model.Subcategory;
            p.SiteUrl = !String.IsNullOrEmpty(model.SiteUrl) ? FormInputHelper.StripInput(model.SiteUrl): String.Empty;

            return p;
        }