示例#1
0
 public string CountMyFoodsWithSameIdAsAppFoods(string userId)
 {
     try {
         int           count    = 0;
         List <string> appFoods = f.LoadFoodsId();
         List <string> myFoods  = LoadMyFoodsId(userId);
         if (myFoods != null)
         {
             if (myFoods.Count > 0)
             {
                 foreach (string id in myFoods)
                 {
                     if (appFoods.Contains(id))
                     {
                         count++;
                     }
                 }
             }
         }
         return(JsonConvert.SerializeObject(string.Format("there are {0} foods with the same id", count), Formatting.None));
     }
     catch (Exception e) {
         L.SendErrorLog(e, null, userId, "MyFoods", "CountMyFoodsWithSameIdAsAppFoods");
         return(JsonConvert.SerializeObject(e.Message, Formatting.None));
     }
 }