public async Task <ActionResult> Edit([Bind(Include = "ServicePhotoTitleId,FileName,Title")] ServicePhotoTitle servicePhotoTitle) { if (ModelState.IsValid) { db.Entry(servicePhotoTitle).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index", "CompanyServices")); } ViewBag.ServicePhotoTitleId = new SelectList(db.CompanyServices, "CompanyServiceId", "Name", servicePhotoTitle.ServicePhotoTitleId); return(View(servicePhotoTitle)); }
public async Task <ActionResult> DeleteConfirmed(int id, string deleteFileName) { PhotoFileManager manager = new PhotoFileManager(PhotoManagerType.ServiceTitle); manager.Delete(deleteFileName, false); ServicePhotoTitle servicePhotoTitle = await db.ServicePhotoTitles.FindAsync(id); db.ServicePhotoTitles.Remove(servicePhotoTitle); await db.SaveChangesAsync(); return(RedirectToAction("Index", "CompanyServices")); }
// GET: ServicePhotoTitles/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServicePhotoTitle servicePhotoTitle = await db.ServicePhotoTitles.FindAsync(id); if (servicePhotoTitle == null) { return(HttpNotFound()); } return(View(servicePhotoTitle)); }
// GET: ServicePhotoTitles/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServicePhotoTitle servicePhotoTitle = await db.ServicePhotoTitles.FindAsync(id); if (servicePhotoTitle == null) { return(HttpNotFound()); } ViewBag.ServicePhotoTitleId = new SelectList(db.CompanyServices, "CompanyServiceId", "Name", servicePhotoTitle.ServicePhotoTitleId); return(View(servicePhotoTitle)); }