public ActionResult DeleteConfirmed(int id) { CropPostDetailModel cropPostDetailModel = db.CropPostDetailModels.Find(id); db.CropPostDetailModels.Remove(cropPostDetailModel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CropPostDetailId,Details,CropPostId,CropId,Price,Status,Created")] CropPostDetailModel cropPostDetailModel) { if (ModelState.IsValid) { db.Entry(cropPostDetailModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CropId = new SelectList(db.CropModels, "Id", "Name", cropPostDetailModel.CropId); ViewBag.CropPostId = new SelectList(db.CropPostModels, "CropPostId", "Title", cropPostDetailModel.CropPostId); return(View(cropPostDetailModel)); }
// GET: CropPostDetail/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CropPostDetailModel cropPostDetailModel = db.CropPostDetailModels.Find(id); if (cropPostDetailModel == null) { return(HttpNotFound()); } return(View(cropPostDetailModel)); }
// GET: CropPostDetail/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CropPostDetailModel cropPostDetailModel = db.CropPostDetailModels.Find(id); if (cropPostDetailModel == null) { return(HttpNotFound()); } ViewBag.CropId = new SelectList(db.CropModels, "Id", "Name", cropPostDetailModel.CropId); ViewBag.CropPostId = new SelectList(db.CropPostModels, "CropPostId", "Title", cropPostDetailModel.CropPostId); return(View(cropPostDetailModel)); }
public ActionResult Create([Bind(Include = "CropPostDetailId,Details,CropPostId,CropId,Price,Status,Created")] CropPostDetailModel cropPostDetailModel) { if (ModelState.IsValid) { if (Session["CropPostId"] != null) { cropPostDetailModel.CropPostId = (int)Session["CropPostId"]; } db.CropPostDetailModels.Add(cropPostDetailModel); db.SaveChanges(); return(RedirectToAction("Index", new { id = (int)Session["CropPostId"] })); } ViewBag.CropId = new SelectList(db.CropModels, "Id", "Name", cropPostDetailModel.CropId); ViewBag.CropPostId = new SelectList(db.CropPostModels, "CropPostId", "Title", cropPostDetailModel.CropPostId); return(View(cropPostDetailModel)); }