コード例 #1
0
 public ActionResult updateCatergoryDetails(CategoryInfo c)
 {
     if (!isAdmin())
     {
         return(RedirectToAction("LogIn", "Main"));
     }
     if (ModelState.IsValid)
     {
         Customer a   = (Customer)Session["loggedInUser"];
         Category cat = new Category();
         cat.ID   = c.id;
         cat.name = c.name;
         var b = _categoryBLL.updateCategory(c.id, cat, a.id);
         if (b)
         {
             return(Json(new { success = true, message = "Kategorien ble endret", redirect = "/Category/ListCategories" }));
         }
         return(Json(new { success = false, message = "Noe gikk galt, prøv igjen senere" }));
     }
     return(Json(new { success = false, message = "Feil i validering" }));
 }