Exemple #1
0
 /// <summary>
 /// Service level call : Creates a single record of a Course
 /// </summary>
 /// <param name="dtoCourse"></param>
 public void Create(DTOCourse dtoCourse)
 {
     dtoCourse.CreatedDate = DateTime.Now;
     dtoCourse.IsDeleted   = false;
     dtoCourse.Id          = Guid.NewGuid();
     _repository.Add(_mapper.Map <DTOCourse, DBCourse>(dtoCourse));
 }
Exemple #2
0
        /// <summary>
        /// Service level call : Updates the Single Record of a Course
        /// </summary>
        /// <param name="dtoCourse"></param>
        public void Update(DTOCourse dtoCourse)
        {
            var course = Get(dtoCourse.Id);

            if (course != null)
            {
                dtoCourse.UpdateDate = DateTime.Now;
                var updated = _mapper.Map(dtoCourse, course);
                dtoCourse.IsDeleted = false;

                _repository.Update(_mapper.Map <DTOCourse, DBCourse>(updated));
            }
        }