public async Task Load() { var posts = await http.GetAll(); Posts.Clear(); foreach (var p in posts) { Posts.Add(mapper.from(p)); } var popularPosts = await http.GetPopular(); PopularPosts.Clear(); foreach (var p in popularPosts) { PopularPosts.Add(mapper.from(p)); } var suggestedPosts = await http.GetSuggested(); SuggestedPosts.Clear(); foreach (var p in suggestedPosts) { SuggestedPosts.Add(mapper.from(p)); } }
public ActionResult DeleteConfirmed(int id) { PopularPosts popularPosts = db.PopularPosts.Find(id); db.PopularPosts.Remove(popularPosts); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,LinkText")] PopularPosts popularPosts) { if (ModelState.IsValid) { db.Entry(popularPosts).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(popularPosts)); }
public ActionResult Create([Bind(Include = "Id,LinkText")] PopularPosts popularPosts) { if (ModelState.IsValid) { db.PopularPosts.Add(popularPosts); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(popularPosts)); }
// GET: Admin/PopularPosts/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PopularPosts popularPosts = db.PopularPosts.Find(id); if (popularPosts == null) { return(HttpNotFound()); } return(View(popularPosts)); }