public async Task <ActionResult> Edit([Bind(Include = "ServiceTitleImageId,Title,FileName")] ServiceTitleImage serviceTitleImage)
        {
            if (ModelState.IsValid)
            {
                db.Entry(serviceTitleImage).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index", "CompanyServices"));
            }
            ViewBag.ServiceTitleImageId = new SelectList(db.CompanyServices, "CompanyServiceId", "Title", serviceTitleImage.ServiceTitleImageId);
            return(View(serviceTitleImage));
        }
        // GET: ServiceTitleImages/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ServiceTitleImage serviceTitleImage = await db.ServiceTitleImages.FindAsync(id);

            if (serviceTitleImage == null)
            {
                return(HttpNotFound());
            }
            return(View(serviceTitleImage));
        }
        public async Task <ActionResult> DeleteConfirmed(int id, string deleteFileName)
        {
            //delete image file without thumbnail
            PhotoFileManager manager = new PhotoFileManager(PhotoManagerType.ServiceTitle);

            manager.Delete(deleteFileName, false);

            ServiceTitleImage serviceTitleImage = await db.ServiceTitleImages.FindAsync(id);

            db.ServiceTitleImages.Remove(serviceTitleImage);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index", "CompanyServices"));
        }
        // GET: ServiceTitleImages/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ServiceTitleImage serviceTitleImage = await db.ServiceTitleImages.FindAsync(id);

            if (serviceTitleImage == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ServiceTitleImageId = new SelectList(db.CompanyServices, "CompanyServiceId", "Title", serviceTitleImage.ServiceTitleImageId);
            ViewBag.ImageType           = PhotoManagerType.ServiceTitle;
            ViewBag.ImageDirectory      = PhotoFileManager.StorageDirectoryDetection(PhotoManagerType.ServiceTitle);
            return(View(serviceTitleImage));
        }