/// <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(); } }
/// <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(); } }
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); }