Esempio n. 1
0
 public static ShareCount SaveShareCount(ShareCount shareCount)
 {
     using (EFDbContext db = new EFDbContext())
     {
         var modal = db.ShareCount.Add(shareCount);
         int row   = db.SaveChanges();
         return(modal);
     }
 }
Esempio n. 2
0
 public static ShareCount Update(ShareCount shareCount)
 {
     using (EFDbContext db = new EFDbContext())
     {
         var modal = db.ShareCount.Where(o => o.ID == shareCount.ID).FirstOrDefault();
         modal.count = shareCount.count;
         modal.type  = shareCount.type;
         int row = db.SaveChanges();
         return(modal);
     }
 }
Esempio n. 3
0
        public static ShareCount SaveUserShareCount(string useropenid, string type)
        {
            var model = GetUserShareCount(useropenid, type);

            if (model != null)
            {
                model.count = model.count + 1;
                Update(model);
            }
            else
            {
                model = new ShareCount()
                {
                    count  = 1,
                    type   = type,
                    openid = useropenid
                };
                SaveShareCount(model);
            }

            return(model);
        }