public ActionResult DeleteConfirmed(int id) { StallCategory stallCategory = db.StallCategories.Find(id); db.StallCategories.Remove(stallCategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,StallType,CreatedBy,CreatedAt")] StallCategory stallCategory) { if (ModelState.IsValid) { stallCategory.CreatedAt = DateTime.Now; stallCategory.CreatedBy = User.Identity.GetUserId(); db.Entry(stallCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CreatedBy = new SelectList(db.AspNetUsers, "Id", "Email", stallCategory.CreatedBy); return(View(stallCategory)); }
// GET: StallCategories/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StallCategory stallCategory = db.StallCategories.Find(id); if (stallCategory == null) { return(HttpNotFound()); } return(View(stallCategory)); }
// GET: StallCategories/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StallCategory stallCategory = db.StallCategories.Find(id); if (stallCategory == null) { return(HttpNotFound()); } ViewBag.CreatedBy = new SelectList(db.AspNetUsers, "Id", "Email", stallCategory.CreatedBy); return(View(stallCategory)); }