public ActionResult DeleteConfirmed(long id) { PostD postD = db.PostDs.Find(id); db.PostDs.Remove(postD); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,SourceId,SearchTypeId,UserId,UserName,Text,CreatedDateTime,Long,Lat,Location,Email,IsSelected")] PostD postD) { if (ModelState.IsValid) { db.Entry(postD).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SearchTypeId = new SelectList(db.SearchTypes, "Id", "Name", postD.SearchTypeId); ViewBag.SourceId = new SelectList(db.Sources, "Id", "Name", postD.SourceId); return(View(postD)); }
// GET: api/Posts public List <PostD> GetPost() { List <PostD> pList = new List <PostD>(); foreach (var item in db.Post) { PostD pD = new PostD(); pD.Post1 = item.Post1; pD.PostID = item.PostID; pList.Add(pD); } return(pList); }
// GET: PostDs/Details/5 public ActionResult Details(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PostD postD = db.PostDs.Find(id); if (postD == null) { return(HttpNotFound()); } return(View(postD)); }
// GET: PostDs/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PostD postD = db.PostDs.Find(id); if (postD == null) { return(HttpNotFound()); } ViewBag.SearchTypeId = new SelectList(db.SearchTypes, "Id", "Name", postD.SearchTypeId); ViewBag.SourceId = new SelectList(db.Sources, "Id", "Name", postD.SourceId); return(View(postD)); }