public async Task <ActionResult> Edit([Bind(Include = "ServiceIconPhotoId,FileName,Title")] ServiceIconPhoto serviceIconPhoto) { if (ModelState.IsValid) { db.Entry(serviceIconPhoto).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index", "CompanyServices")); } ViewBag.ServiceIconPhotoId = new SelectList(db.CompanyServices, "CompanyServiceID", "Title", serviceIconPhoto.ServiceIconPhotoId); return(View(serviceIconPhoto)); }
public async Task <ActionResult> DeleteConfirmed(int id, string deleteFileName) { //delete service icon file image PhotoFileManager manager = new PhotoFileManager(PhotoManagerType.ServiceTitle); manager.Delete(deleteFileName, false); ServiceIconPhoto serviceIconPhoto = await db.ServiceIconPhotos.FindAsync(id); db.ServiceIconPhotos.Remove(serviceIconPhoto); await db.SaveChangesAsync(); return(RedirectToAction("Index", "CompanyServices")); }
// GET: ServiceIconPhotoes/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServiceIconPhoto serviceIconPhoto = await db.ServiceIconPhotos.FindAsync(id); if (serviceIconPhoto == null) { return(HttpNotFound()); } return(View(serviceIconPhoto)); }
// GET: ServiceIconPhotoes/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServiceIconPhoto serviceIconPhoto = await db.ServiceIconPhotos.FindAsync(id); if (serviceIconPhoto == null) { return(HttpNotFound()); } ViewBag.ImageType = PhotoManagerType.ServiceTitle; ViewBag.ImageDirectory = PhotoFileManager.StorageDirectoryDetection(PhotoManagerType.ServiceTitle); return(View(serviceIconPhoto)); }