Пример #1
0
 public static Subscription CreateSubscription(string name, string email, bool isconfirmed)
 {
     var subscription = new Subscription();
     subscription.SubscriberName = name;
     subscription.SubscriberEmail = email;
     subscription.IsConfirmed = isconfirmed;
     subscription.ConfirmationToken = GenerateToken();
     subscription.DateCreated = DateTime.UtcNow;
     subscription.SubscriptionType = SubscriptionType.Newsletter;
     return subscription;
 }
Пример #2
0
 public static Subscription CreateSubscription(string name, string email, bool isconfirmed, Post post)
 {
     var subscription = new Subscription();
     subscription.SubscriberName = name;
     subscription.SubscriberEmail = email;
     subscription.IsConfirmed = isconfirmed;
     subscription.ConfirmationToken = GenerateToken();
     subscription.DateCreated = DateTime.UtcNow;
     subscription.SubscriptionType = SubscriptionType.Comments;
     subscription.AddPost(post);
     return subscription;
 }
Пример #3
0
 public ActionResult Edit(Subscription subscription)
 {
     if (ModelState.IsValid)
     {
         try
         {
             SubscriptionServices.SaveEntity(subscription);
         }
         catch (ApplicationValidationErrorsException ex)
         {
             ModelState.AddModelError("SubscriberEmail", ex.ValidationErrors.First());
             return View(subscription);
         }
         return RedirectToAction("Index");
     }
     return View(subscription);
 }
Пример #4
0
 public void SetSubscription(Subscription subscription)
 {
     this.SubscriptionId = subscription.SubscriptionId;
     this.Subscription = subscription;
 }