public ActionResult DeleteConfirmed(int id)
        {
            OurWorkGallery ourWorkGallery = db.OurWorkGallery.Find(id);

            if (ourWorkGallery.Image != null)
            {
                System.IO.File.Delete(Server.MapPath("/PageImages/" + ourWorkGallery.Image));
            }
            db.OurWorkGallery.Remove(ourWorkGallery);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: Admin/OurWorkGalleries/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OurWorkGallery ourWorkGallery = db.OurWorkGallery.Find(id);

            if (ourWorkGallery == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(ourWorkGallery));
        }
        // GET: Admin/OurWorkGalleries/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OurWorkGallery ourWorkGallery = db.OurWorkGallery.Find(id);

            if (ourWorkGallery == null)
            {
                return(HttpNotFound());
            }
            ViewBag.OurWorkGalleryTypeId = new SelectList(db.OurWorkGalleryType, "id", "Title", ourWorkGallery.OurWorkGalleryType);
            return(PartialView(ourWorkGallery));
        }
        public ActionResult Create([Bind(Include = "id,OurWorkGalleryTypeid,Name,Image,idSize")] OurWorkGallery ourWorkGallery, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                if (Image != null)
                {
                    ourWorkGallery.Image = Guid.NewGuid() + Path.GetExtension(Image.FileName);
                    Image.SaveAs(Server.MapPath("/PageImages/" + ourWorkGallery.Image));
                }
                ourWorkGallery.date = DateTime.Now;
                db.OurWorkGallery.Add(ourWorkGallery);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.OurWorkGalleryTypeId = new SelectList(db.OurWorkGalleryType, "OurWorkGalleryTypeid", "Title", ourWorkGallery.OurWorkGalleryType);
            return(PartialView(ourWorkGallery));
        }
        public ActionResult Edit([Bind(Include = "id,OurWorkGalleryTypeid,Name,Image,idSize,date")] OurWorkGallery ourWorkGallery, HttpPostedFileBase imgUp)
        {
            if (ModelState.IsValid)
            {
                if (imgUp != null)
                {
                    if (ourWorkGallery.Image != null)
                    {
                        System.IO.File.Delete(Server.MapPath("/PageImages/" + ourWorkGallery.Image));
                    }


                    ourWorkGallery.Image = Guid.NewGuid() + Path.GetExtension(imgUp.FileName);
                    imgUp.SaveAs(Server.MapPath("/PageImages/" + ourWorkGallery.Image));
                }

                db.Entry(ourWorkGallery).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.OurWorkGalleryTypeId = new SelectList(db.OurWorkGalleryType, "OurWorkGalleryTypeid", "Title", ourWorkGallery.OurWorkGalleryType);
            return(PartialView(ourWorkGallery));
        }