public async Task <ActionResult> DeleteConfirmed(int id) { ParkingImage parkingImage = await db.ParkingImages.FindAsync(id); db.ParkingImages.Remove(parkingImage); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "ImageID,ParkingID,ImagePath")] ParkingImage parkingImage) { if (ModelState.IsValid) { db.Entry(parkingImage).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(parkingImage)); }
public bool Insert(ParkingImage pImg) { try { obj.ParkingImages.Add(pImg); return(obj.SaveChanges() > 0); } catch { return(false); } }
public async Task <ActionResult> Create([Bind(Include = "ImageID,ParkingID,ImagePath")] ParkingImage parkingImage) { if (ModelState.IsValid) { db.ParkingImages.Add(parkingImage); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(parkingImage)); }
public bool Update(ParkingImage ParkingImage) { try { ParkingImage updateParkingImage = obj.ParkingImages.Find(ParkingImage.ImageID); updateParkingImage.ImagePath = ParkingImage.ImagePath; return(obj.SaveChanges() > 0); } catch { return(false); } }
// GET: Admin/ParkingImages/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ParkingImage parkingImage = await db.ParkingImages.FindAsync(id); if (parkingImage == null) { return(HttpNotFound()); } return(View(parkingImage)); }