public async Task <IActionResult> Edit(int id, [Bind("Id,FeedUrl,LearningResourceId")] ContentFeed contentFeed) { if (id != contentFeed.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(contentFeed); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContentFeedExists(contentFeed.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LearningResourceId"] = new SelectList(_context.LearningResources, "Id", "Id", contentFeed.LearningResourceId); return(View(contentFeed)); }
public async Task <IActionResult> Create([Bind("Id,FeedUrl,LearningResourceId")] ContentFeed contentFeed) { if (ModelState.IsValid) { _context.Add(contentFeed); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["LearningResourceId"] = new SelectList(_context.LearningResources, "Id", "Id", contentFeed.LearningResourceId); return(View(contentFeed)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } ContentFeed = await _context.ContentFeeds .Include(c => c.LearningResource).FirstOrDefaultAsync(m => m.Id == id); if (ContentFeed == null) { return(NotFound()); } return(Page()); }
ContentFeed <FeedItem> GetItemList() { //instantiate the feed ContentFeed <FeedItem> feed = new ContentFeed <FeedItem>(); //populate the list of feed items feed.FeedItems = GenerateItemList(); //set some feed-level properties feed.FeedAuthor = "*****@*****.**"; feed.FeedTitle = "Stern Feed"; feed.FeedDescription = "Stern Feed"; feed.FeedId = ItemNs; feed.FeedWebPageLink = ItemNs; //return the feed return(feed); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } ContentFeed = await _context.ContentFeeds .Include(c => c.LearningResource).FirstOrDefaultAsync(m => m.Id == id); if (ContentFeed == null) { return(NotFound()); } ViewData["LearningResourceId"] = new SelectList(_context.LearningResources, "Id", "Id"); return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } ContentFeed = await _context.ContentFeeds.FindAsync(id); if (ContentFeed != null) { _context.ContentFeeds.Remove(ContentFeed); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }