/// <summary> /// 更新 /// </summary> public void Update() { BackendContext db = new BackendContext(); this.UpdateDate = DateTime.Now; this.Updater = System.Web.HttpContext.Current.User.Identity.Name; db.Entry(this).State = EntityState.Modified; db.SaveChanges(); }
/// <summary> /// 新增 /// </summary> public void Create(BackendContext db, System.Data.Entity.DbSet dbSet) { if (this.InitDate == null) { this.InitDate = DateTime.Now; } this.Poster = System.Web.HttpContext.Current.User.Identity.Name; dbSet.Add(this); db.SaveChanges(); }