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; }
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; }
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); }
public void SetSubscription(Subscription subscription) { this.SubscriptionId = subscription.SubscriptionId; this.Subscription = subscription; }