public async Task <IActionResult> Edit(int id, [Bind("ID,Description,Size,Colour,Quantity")] Outerwear outerwear) { if (id != outerwear.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(outerwear); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OuterwearExists(outerwear.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(outerwear)); }
public ActionResult DeleteConfirmed(int id) { Outerwear outerwear = db.Outerwears.Find(id); db.Outerwears.Remove(outerwear); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <IActionResult> Create([Bind("ID,Description,Size,Colour,Quantity")] Outerwear outerwear) { if (ModelState.IsValid) { _context.Add(outerwear); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(outerwear)); }
public ActionResult Edit([Bind(Include = "OuterwearID,OuterwearName,OuterwearPhoto,OuterwearTypeID,OuterwearColorID,OuterwearSeasonID,OuterwearOccassionID")] Outerwear outerwear) { if (ModelState.IsValid) { db.Entry(outerwear).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OuterwearColorID = new SelectList(db.OuterwearColors, "OuterwearColorID", "OuterwearColorName", outerwear.OuterwearColorID); ViewBag.OuterwearOccassionID = new SelectList(db.OuterwearOccassions, "OuterwearOccassionID", "OuterwearOccassionName", outerwear.OuterwearOccassionID); ViewBag.OuterwearSeasonID = new SelectList(db.OuterwearSeasons, "OuterwearSeasonID", "OuterwearSeasonName", outerwear.OuterwearSeasonID); ViewBag.OuterwearTypeID = new SelectList(db.OuterwearTypes, "OuterwearTypeID", "OuterwearTypeName", outerwear.OuterwearTypeID); return(View(outerwear)); }
// GET: Outerwears/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Outerwear outerwear = db.Outerwears.Find(id); if (outerwear == null) { return(HttpNotFound()); } return(View(outerwear)); }
// GET: Outerwears/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Outerwear outerwear = db.Outerwears.Find(id); if (outerwear == null) { return(HttpNotFound()); } ViewBag.OuterwearColorID = new SelectList(db.OuterwearColors, "OuterwearColorID", "OuterwearColorName", outerwear.OuterwearColorID); ViewBag.OuterwearOccassionID = new SelectList(db.OuterwearOccassions, "OuterwearOccassionID", "OuterwearOccassionName", outerwear.OuterwearOccassionID); ViewBag.OuterwearSeasonID = new SelectList(db.OuterwearSeasons, "OuterwearSeasonID", "OuterwearSeasonName", outerwear.OuterwearSeasonID); ViewBag.OuterwearTypeID = new SelectList(db.OuterwearTypes, "OuterwearTypeID", "OuterwearTypeName", outerwear.OuterwearTypeID); return(View(outerwear)); }