Example #1
0
 public static string Save(int pVideoID = 0, int partID = 0, int vTypeID = 0, string video = "", bool isPrimary = false)
 {
     CurtDevDataContext db = new CurtDevDataContext();
     PartVideo v = new PartVideo();
     try {
         if(pVideoID > 0) {
             v = db.PartVideos.Where(x => x.pVideoID == pVideoID).First<PartVideo>();
             v.video = video;
             v.isPrimary = isPrimary;
             v.vTypeID = vTypeID;
             v.partID = partID;
             db.SubmitChanges();
         } else {
             v = new PartVideo {
                 isPrimary = isPrimary,
                 vTypeID = vTypeID,
                 video = video,
                 partID = partID
             };
             db.PartVideos.InsertOnSubmit(v);
             db.SubmitChanges();
         }
         ProductModels.UpdatePart(partID);
     } catch {
         return "error";
     }
     return JsonConvert.SerializeObject(Get(v.pVideoID));
 }
Example #2
0
 public static PartVideo Get(int videoID = 0)
 {
     PartVideo video = new PartVideo();
     try {
         CurtDevDataContext db = new CurtDevDataContext();
         video = (from p in db.PartVideos
                  where p.pVideoID.Equals(videoID)
                     select p).First<PartVideo>();
     } catch { }
     return video;
 }