public async Task <IActionResult> Edit(string id, [Bind("DimId,DimType,DimSubType,DimCrt,DimPrice,DimImg")] DimInfoMst dimInfoMst) { if (id != dimInfoMst.DimId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dimInfoMst); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DimInfoMstExists(dimInfoMst.DimId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(dimInfoMst)); }
public ActionResult Create([Bind(Include = "dimId,dimShape,dimCrt,dimSize,dimColor,dimClarity,dimCut,dimPolish,dimSymmetry,dimReport,dimRate,dimImg")] DimInfoMst dimInfoMst, HttpPostedFileBase[] files) { if (ModelState.IsValid) { int index = 0; foreach (HttpPostedFileBase file in files) { index++; //Checking file is available to save. if (file != null) { if (files.Length != index) { dimInfoMst.dimImg += file.FileName + ", "; } else { dimInfoMst.dimImg += file.FileName; } var InputFileName = Path.GetFileName(file.FileName); var ServerSavePath = Path.Combine(Server.MapPath("~/assets/image/") + InputFileName); //Save file to server folder file.SaveAs(ServerSavePath); } }//end of insert image db.DimInfoMsts.Add(dimInfoMst); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dimInfoMst)); }
public ActionResult DeleteConfirmed(string id) { DimInfoMst dimInfoMst = db.DimInfoMsts.Find(id); db.DimInfoMsts.Remove(dimInfoMst); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <IActionResult> Create([Bind("DimId,DimType,DimSubType,DimCrt,DimPrice,DimImg")] DimInfoMst dimInfoMst) { if (ModelState.IsValid) { _context.Add(dimInfoMst); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(dimInfoMst)); }
// GET: Admin/DimInfoMsts/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DimInfoMst dimInfoMst = db.DimInfoMsts.Find(id); if (dimInfoMst == null) { return(HttpNotFound()); } return(View(dimInfoMst)); }