コード例 #1
0
 public JsonResult UpdateTag(string id, string title, string isviewable, string oper)
 {
     try
     {
         long tagID;
         bool isViewable;
         Boolean.TryParse(isviewable, out isViewable);
         if (oper == "del")
         {
             if (!Int64.TryParse(id, out tagID))
             {
                 return(JSON(false));
             }
             GeneralRepository.DeleteTag(tagID);
         }
         else
         {
             if (oper == "add")
             {
                 id = "0";
             }
             if (!Int64.TryParse(id, out tagID))
             {
                 return(JSON(false));
             }
             GeneralRepository.UpdateTag(new Tag {
                 ID = tagID, Title = title, IsViewable = isViewable
             });
         }
     }
     catch (Exception ex)
     {
         return(JSON(new Object[] { false, ex.Message }));
     }
     try
     {
         System.Net.WebClient client = new System.Net.WebClient();
         client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
         client.OpenRead(Consts.CacheClearFrontendIP + Consts.FrontEndClearMethod);
     }
     catch (Exception ex)
     {
         Logger.LogException("[" + Consts.CacheClearFrontendIP + Consts.FrontEndClearMethod + "]", ex);
     }
     return(JSON(true));
 }