Beispiel #1
0
 public IActionResult OnPost()
 {
     if (ModelState.IsValid)
     {
         var subscription  = SubscriptionEmail.ToModel();
         var isSuccessfull = _subscriptionsService.Create(subscription);
         if (isSuccessfull)
         {
             return(RedirectToPage("Index"));
         }
         else
         {
             Message = $"There is already a subscription with the email: {subscription.Email}";
             return(Page());
         }
     }
     return(Page());
 }
 public IActionResult OnPost()
 {
     if (ModelState.IsValid)
     {
         var subscription  = SubscriptionEmail.ToModel();
         var isSuccessfull = _subscriptionsService.Create(subscription);
         if (isSuccessfull)
         {
             OnGet();
             return(Page());
         }
         else
         {
             OnGet();
             MessageAboutSubscribing = $"There is already a subscription with the email: {subscription.Email}";
             return(Page());
         }
     }
     return(Page());
 }