public void Update(Notice model) { var target = Find(model.ID); db.Attach<Notice>(target); target.Name = model.Name; target.Content = model.Content; target.DepartmentID = model.DepartmentID; db.Commit(); }
public Notice Create(ViewModels.NoticeViewModel model) { Notice entity = new Notice(); entity.AddTime = DateTime.Now; entity.AddUser = CookieHelper.MemberID; entity.LastTime = DateTime.Now; entity.LastUser = CookieHelper.MemberID; entity.DepartmentID = model.DepartmentID; entity.Content = model.Content; entity.Name = model.Name; db.Add<Notice>(entity); db.Commit(); return entity; }
public void Delete(Notice model) { var target = Find(model.ID); db.Remove<Notice>(target); db.Commit(); }
public void Create(Notice model) { db.Add<Notice>(model); db.Commit(); }