Esempio n. 1
0
 /// <summary>
 ///添加
 /// </summary>
 /// <param name="model"></param>
 public void Add(ImageInfoDbModel model)
 {
     using (var dbcontext = new ImageMySqlEntities())
     {
         var result = dbcontext.Set <ImageInfoDbModel>().Add(model);
         dbcontext.SaveChanges();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="model"></param>
 public void Update(ImageInfoDbModel model)
 {
     using (var dbcontext = new ImageMySqlEntities())
     {
         dbcontext.Entry <ImageInfoDbModel>(model).State = EntityState.Modified;
         dbcontext.SaveChanges();
     }
 }
Esempio n. 3
0
        private void UpDate(string path, int ServiceId)
        {
            var image = new ImageManager();
            var model = new ImageInfoDbModel();

            model.CreateDate    = DateTime.Now;
            model.ImageName     = path;
            model.ImageServerId = ServiceId;
            image.Add(model);

            var ImageService = new ImageServiceManager();
            var dbmodel      = ImageService.Get(ServiceId);

            dbmodel.CurPicAmount++;
            if (dbmodel.CurPicAmount >= dbmodel.MaxPicAmount)
            {
                dbmodel.FlgUsable = false;
            }
            ImageService.Update(dbmodel);
        }