Esempio n. 1
0
        public ActionResult newSubCategory(SubCategoryDetail sc)
        {
            if (!isAdmin())
            {
                return(RedirectToAction("LogIn", "Main"));
            }

            if (ModelState.IsValid)
            {
                Customer admin   = (Customer)Session["loggedInUser"];
                var      adminid = admin.id;
                if (_categoryBLL.AddSub(adminid, new SubCategory()
                {
                    name = sc.name,
                    catId = sc.categoryId
                }))
                {
                    return(Json(new { success = true, message = "Ny subkategori ble lagt til", redirect = "/Category/ListSubCategories/" }));
                }
                return(Json(new { success = false, message = "Dette gikk ikke så bra, prøv igjen en annen gang" }));
            }
            return(Json(new { success = false, message = "Feil i validering" }));
        }