Ejemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "ID,Name,SubscriptionCost,TotalSubscriptionCost")] UserSubscription userSubscription)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userSubscription).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userSubscription));
 }
 public void Create(Subscription subscription)
 {
     _subscriptionDbContext.Subscriptions.Add(subscription);
     _subscriptionDbContext.SaveChangesAsync();
     _subscriptionDbContext.SubscriptionJobs.Add(new SubscriptionJob()
     {
         ExecutionDate  = subscription.EndDate,
         IsExecuted     = false,
         SubscriptionId = subscription.Id
     });
     _subscriptionDbContext.Entry(subscription).State = EntityState.Detached;
     _subscriptionDbContext.SaveChangesAsync();
 }