private void attach_JobOffer(JobOffers off) { NotifyPropertyChanging("JobOffer"); off.Category = this; }
private void detach_JobOffer(JobOffers off) { NotifyPropertyChanging("JobOffer"); off.Category = null; }
public void AddJobOffer(JobOffers ent) { var exists = from t in bjDB.JobOffers where t.OfferId == ent.OfferId select t; if (exists.Count() == 0) { ent.Category = bjDB.Categories.Where(c => c.CategoryId == ent.CategoryId).FirstOrDefault(); bjDB.JobOffers.InsertOnSubmit(ent); AllJobOffers.Add(ent); } else { JobOffers t = exists.FirstOrDefault(); t.HumanYn = ent.HumanYn; t.Category = ent.Category; t.CategoryId = ent.CategoryId; t.Email = ent.Email; t.FreelanceYn = ent.FreelanceYn; t.Negativism = ent.Negativism; t.Positivism = ent.Positivism; t.Title = ent.Title; t.PublishDate = ent.PublishDate; t.Icon = ent.Icon; t.Category = bjDB.Categories.Where(c => c.CategoryId == t.CategoryId).FirstOrDefault(); } bjDB.SubmitChanges(); }