Пример #1
0
 /// <summary>
 /// Convert a given voteQuestion to a ViewModel
 /// </summary>
 public static ViewModels.Newsletter ToViewModel(this Models.Newsletter newsletter)
 {
     ViewModels.Newsletter result = null;
     if (newsletter != null)
     {
         result             = new ViewModels.Newsletter();
         result.id          = newsletter.Id.ToString();
         result.description = newsletter.Description;
         result.slug        = newsletter.Slug;
         result.title       = newsletter.Title;
     }
     return(result);
 }
        /// <summary>
        /// Adds a jurisdiction to the system, only if it does not exist.
        /// </summary>
        private static void AddInitialNewsletter(this IDynamicsClient context, ViewModels.Newsletter initialNewsletter)
        {
            Newsletter newsletter = context.GetNewsletterBySlug(initialNewsletter.slug);

            if (newsletter != null)
            {
                return;
            }

            newsletter = new Newsletter
                         (
                initialNewsletter.slug,
                initialNewsletter.title,
                initialNewsletter.description
                         );

            context.AddNewsletter(newsletter);
        }