public async Task <ActionResult> DeleteConfirmed(int id) { InfraGallery infraGallery = await db.InfraGalleries.FindAsync(id); db.InfraGalleries.Remove(infraGallery); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "InfGalId,Infraid,Image")] InfraGallery infraGallery, HttpPostedFileBase file, Helper help) { if (ModelState.IsValid) { infraGallery.Image = file != null?help.Resize(file, 400, 1200) : img; db.Entry(infraGallery).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.Infraid = new SelectList(db.infrastructureDatas, "Infraid", "Name", infraGallery.Infraid); return(View(infraGallery)); }
// GET: Auth/InfraGalleries/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InfraGallery infraGallery = await db.InfraGalleries.FindAsync(id); if (infraGallery == null) { return(HttpNotFound()); } return(View(infraGallery)); }
// GET: Auth/InfraGalleries/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InfraGallery infraGallery = await db.InfraGalleries.FindAsync(id); img = infraGallery.Image; if (infraGallery == null) { return(HttpNotFound()); } ViewBag.Infraid = new SelectList(db.infrastructureDatas, "Infraid", "Name", infraGallery.Infraid); return(View(infraGallery)); }
public async Task <ActionResult> Create([Bind(Include = "InfGalId,Infraid,Image")] InfraGallery infraGallery, IEnumerable <HttpPostedFileBase> file, Helper help) { if (ModelState.IsValid) { foreach (var a in file) { infraGallery.Image = help.Resize(a, 400, 1200); db.InfraGalleries.Add(infraGallery); await db.SaveChangesAsync(); } return(RedirectToAction("Index")); } ViewBag.Infraid = new SelectList(db.infrastructureDatas, "Infraid", "Name", infraGallery.Infraid); return(View(infraGallery)); }