Exemple #1
0
        public static NoticeViewModel ToNoticeViewModel(Notice n)
        {
            NoticeViewModel vm = new NoticeViewModel
            {
                Id             = n.NoticeId,
                Title          = n.Title,
                NoticeBoardId  = n.NoticeBoardId,
                Description    = n.Description,
                DateCreated    = n.DateCreated,
                isHighPriority = n.HighPriority
            };

            return(vm);
        }
Exemple #2
0
        public static Notice From(NoticeViewModel vm)
        {
            Notice n = new Notice
            {
                NoticeId      = vm.Id,
                Title         = vm.Title,
                NoticeBoardId = vm.NoticeBoardId,
                Description   = vm.Description,
                HighPriority  = vm.isHighPriority
            };

            if (vm.DateCreated.HasValue)
            {
                n.DateCreated = vm.DateCreated.Value;
            }
            return(n);
        }