Beispiel #1
0
        /// <summary>
        /// Remove Conten
        /// </summary>
        /// <param name="contentViewModel"></param>
        public void RemoveContent(ContentViewModel contentViewModel)
        {
            var content = contentViewModel.ConvertToContentModel();

            _contentRepository.Delete(content);
            _contentRepository.SaveChanges();
        }
Beispiel #2
0
        /// <summary>
        /// Create Content
        /// </summary>
        /// <param name="contentViewModel"></param>
        /// <returns></returns>
        public void CreateContent(ContentViewModel contentViewModel)
        {
            var content = contentViewModel.ConvertToContentModel();

            content.CreationTime = DateTime.Now;
            _contentRepository.Add(content);
            _contentRepository.SaveChanges();
        }
Beispiel #3
0
        /// <summary>
        /// Update the Content of Content
        /// </summary>
        /// <param name="contentViewModel"></param>
        /// <returns></returns>
        public Content UpdateContent(ContentViewModel contentViewModel)
        {
            var content = contentViewModel.ConvertToContentModel();

            content.CreationTime = DateTime.Now;
            _contentRepository.Update(content);
            _contentRepository.SaveChanges();
            return(content);
        }
Beispiel #4
0
 /// <summary>
 /// Convert Content Model
 /// </summary>
 /// <param name="contentViewModel"></param>
 /// <returns></returns>
 public static Content ConvertToContentModel(this ContentViewModel contentViewModel)
 {
     return(Mapper.Map <ContentViewModel, Content>(contentViewModel));
 }