예제 #1
0
 public void AddSeminar(SeminarWcf seminar)
 {
     if (seminar.SeminarName == null)
     {
         return;
     }
     _db.Seminars.Add(Mapper.Map <SeminarWcf, Seminar>(seminar));
     _db.SaveChanges();
 }
예제 #2
0
        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();
        }