// POST: ArticleNotifications/Delete/5 public ActionResult DeleteConfirmed(int id) { ArticleNotification articleNotification = db.ArticleNotifications.Find(id); db.ArticleNotifications.Remove(articleNotification); db.SaveChanges(); return(RedirectToAction("UserPortal", "Manage", null)); }
private void CreateArticleNotificationForSubscription(Article article, Subscription subscription, ApplicationDbContext db) { ArticleNotification articleNotification = new ArticleNotification(); articleNotification.ArticleId = article.Id; articleNotification.AspNetUserId = subscription.AspNetUserId; articleNotification.SubscriptionId = subscription.Id; db.ArticleNotifications.Add(articleNotification); }
public ActionResult Create([Bind(Include = "Id,ArticleId,SubscriptionId,AspNetUserId")] ArticleNotification articleNotification) { if (ModelState.IsValid) { db.ArticleNotifications.Add(articleNotification); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ArticleId = new SelectList(db.Articles, "Id", "Title", articleNotification.ArticleId); ViewBag.SubscriptionId = new SelectList(db.Subscriptions, "Id", "AspNetUserId", articleNotification.SubscriptionId); return(View(articleNotification)); }