public void RemoveCompanyEvent(Company company, Event e) { if (e.cId == company.Id) { db.companyEvent.Remove(e); } }
public void CreateCompanyEvent(Company company, string title, string description, DateTime time) { var target = db.company.Find(company.Id); if (target != null) { var companyEvent = new Event { Title = title, Content = description, cId = target.Id, Time = time }; db.companyEvent.Add(companyEvent); db.SaveChanges(); } else { throw new Exception(); } }