public ActionResult addProduct(ProductDetail p)
        {
            if (!isAdmin())
            {
                return(RedirectToAction("LogIn", "Main"));
            }
            if (ModelState.IsValid)
            {
                Customer admin   = (Customer)Session["loggedInUser"];
                var      adminid = admin.id;
                var      result  = _product.addProduct(adminid, new Product()
                {
                    name            = p.name,
                    countryid       = p.countryid,
                    description     = p.description,
                    longDescription = p.longDescription,
                    price           = p.price,
                    producerid      = p.producerid,
                    subCategoryid   = p.subCategoryid,
                    volum           = p.volum
                });


                p.countryList = _product.getCountries().Select(c => new SelectListItem {
                    Value = c.id.ToString(), Text = c.name
                }).ToList();
                p.subCategoryList = _product.getAllSubCategories().Select(s => new GroupedSelectListItem {
                    GroupKey = s.catId.ToString(), GroupName = s.catName, Value = s.ID.ToString(), Text = s.name, Selected = true
                }).ToList();
                p.producerList = _product.getProducers().Select(r => new SelectListItem {
                    Value = r.id.ToString(), Text = r.name
                }).ToList();

                if (result != null)
                {
                    return(Json(new { success = true, message = result.name + " ble lagt til med varenummer " + result.itemnumber, redirect = "/Product/ListProducts/?sortOrder=item_desc" }));
                }
                return(Json(new { success = false, message = "Noe gikk galt, prøv igjen senere" }));
            }
            return(Json(new { success = false, message = "Feil i validering" }));
        }