public void AddSeminar(SeminarWcf seminar) { if (seminar.SeminarName == null) { return; } _db.Seminars.Add(Mapper.Map <SeminarWcf, Seminar>(seminar)); _db.SaveChanges(); }
public void UpdateSeminar(SeminarWcf seminar) { var newSeminar = Mapper.Map <SeminarWcf, Seminar>(seminar); var oldSeminar = _db.Seminars.FirstOrDefault(x => x.SeminarId == seminar.SeminarId); if (oldSeminar == null) { return; } oldSeminar.SeminarName = newSeminar.SeminarName; oldSeminar.SeminarTime = newSeminar.SeminarTime; _db.SaveChanges(); }