コード例 #1
0
        private JsonResult SwitchIsRemoved(string statementId, bool isRemoved)
        {
            int       intStatementId = Convert.ToInt32(statementId);
            Statement statement      = StatementManager.GetStatementById(intStatementId);

            if (User.Identity.IsAuthenticated && User.Identity.GetUserId() == statement.KindergartenId || User.IsInRole("Admin"))
            {
                try
                {
                    StatementManager.SwitchIsRemoved(intStatementId, isRemoved);
                    return(Json(true));
                }
                catch (Exception) { }
            }
            return(Json("Error"));
        }