public async Task <ActionResult> Edit([Bind(Include = "CompanyServicePhotoId,FileName,Title")] CompanyServicePhoto companyServicePhoto, string companyservicesID)
        {
            if (ModelState.IsValid)
            {
                db.Entry(companyServicePhoto).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index", "CompanyServicePhotos", new { id = companyservicesID }));
            }
            return(View(companyServicePhoto));
        }
        // GET: CompanyServicePhotos/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CompanyServicePhoto companyServicePhoto = await db.CompanyServicePhotos.FindAsync(id);

            if (companyServicePhoto == null)
            {
                return(HttpNotFound());
            }
            return(View(companyServicePhoto));
        }
        public async Task <ActionResult> Create([Bind(Include = "CompanyServicePhotoId,FileName,Title")] CompanyServicePhoto companyServicePhoto, int CompanyServiceId)
        {
            if (ModelState.IsValid)
            {
                companyServicePhoto.CompanyService = db.CompanyServices.Find(CompanyServiceId);
                //companyServicePhoto.CompanyService.CompanyServiceId = CompanyServiceId;
                db.CompanyServicePhotos.Add(companyServicePhoto);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index", new { id = CompanyServiceId }));
            }

            return(View(companyServicePhoto));
        }
        public async Task <ActionResult> DeleteConfirmed(int id, string deleteFileName, string companyservicesID)
        {
            //delete image file with thumbnail
            PhotoFileManager manager = new PhotoFileManager(PhotoManagerType.Service);

            manager.Delete(deleteFileName, true);

            CompanyServicePhoto companyServicePhoto = await db.CompanyServicePhotos.FindAsync(id);

            db.CompanyServicePhotos.Remove(companyServicePhoto);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index", "CompanyServicePhotos", new { id = companyservicesID }));
        }