public ActionResult Edit(int id, [Bind(Include = "TitlePL, TitleEN, TitleDE, DescriptionPL, DescriptionEN, DescriptionDE")] Post post) { try { SqlPost.UpdatePost(id, post); //???? czemu id i post, a nie samo post? // TODO: Add update logic here return(RedirectToAction("Index")); } catch { return(View(post)); } }
public ActionResult Delete(int id, FormCollection collection) { try { // Post deletedPost = new Post(); // deletedPost = SqlPost.GetPost(id); SqlPost.DeletePost(id); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create([Bind(Include = "TitlePL, TitleEN, TitleDE, DescriptionPL, DescriptionEN, DescriptionDE")] Post post) { try { if (ModelState.IsValid) { SqlPost.InsertPost(post); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); } catch { return(View(post)); } }
// GET: Post/Delete/5 public ActionResult Delete(int id) { Post post = SqlPost.GetPost(id); return(View(post)); }