예제 #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;
 }