private JsonResult SwitchIsSelected(string statementId, bool isSelected) { int intStatementId = Convert.ToInt32(statementId); Statement statement = StatementManager.GetStatementById(intStatementId); if (User.Identity.IsAuthenticated && User.Identity.GetUserId() == statement.KindergartenId || User.IsInRole("Admin")) { try { StatementManager.SwitchIsSelected(intStatementId, isSelected); return(Json(true)); } catch (Exception) { } } return(Json("Error")); }