//[Authorize(Roles = "Admin,Super Admin,User")] public JsonResult GetConsumption() { if (Session["role"] == null) { Session["userId"] = null; Session["role"] = null; return(Json(null, JsonRequestBehavior.AllowGet)); } else if (Session["role"].ToString() == "Admin" || Session["role"].ToString() == "Super Admin") { var ConsumptionList = consumptionRepository.GetConsumption(); return(Json(ConsumptionList, JsonRequestBehavior.AllowGet)); } else { Session["userId"] = null; Session["role"] = null; return(Json(null, JsonRequestBehavior.AllowGet)); } }