Пример #1
0
        public SYS_Ads GetAdsByID(string id)
        {
            SYS_Ads ret = new SYS_Ads();

            ret = Controllers.Controller_Ads.GetAdsByID(id);
            return(ret);
        }
Пример #2
0
 public static string SaveAds(string id, string name)
 {
     try
     {
         LINQ_AdsDataContext dc         = new LINQ_AdsDataContext();
         SYS_Ads             the_record = new SYS_Ads();
         the_record = (from c in dc.SYS_Ads where c.id == id select c).FirstOrDefault();
         if (the_record != null)
         {
             {
                 the_record.id   = id;
                 the_record.name = name;
             };
         }
         else
         {
             the_record = new SYS_Ads()
             {
                 id   = id,
                 name = name
             };
             dc.SYS_Ads.InsertOnSubmit(the_record);
         }
         dc.SubmitChanges();
         return("Success");
     }
     catch (Exception ex)
     {
         return("Error~" + ex.Message);
     }
     return("");
 }
Пример #3
0
        public static string DeleteAds(string id, string name)
        {
            try
            {
                //Security Check

                LINQ_AdsDataContext dc         = new LINQ_AdsDataContext();
                SYS_Ads             the_record = (from c in dc.SYS_Ads where c.id == id select c).FirstOrDefault();
                if (the_record == null)
                {
                    return("Error~We can't find");
                }
                dc.SYS_Ads.DeleteOnSubmit(the_record);
                dc.SubmitChanges();
                return("Success~");
            }
            catch (ChangeConflictException ex)
            {
                return("Success~");
            }
        }