public ActionResult Create(C_Images c_images)
        {
            if (ModelState.IsValid)
            {
                try {
                    db.C_Images.Add(c_images);
                    db.SaveChanges();
                    ViewBag.sucsessmsg = "select photo to upload";
                    return(RedirectToAction("Index"));
                }
                catch
                {
                    if (c_images.C_Link == null)
                    {
                        return(RedirectToAction("Error", new { errormsg = "you have to fill the iamge`s link field" }));
                    }
                    else
                    {
                        return(RedirectToAction("Error", new { errormsg = "wrong" }));
                    }
                }
            }

            return(View(c_images));
        }
        //
        // GET: /Images/Details/

        public ActionResult Details(int id = 0)
        {
            C_Images c_images = db.C_Images.Find(id);

            if (c_images == null)
            {
                return(HttpNotFound());
            }
            return(View(c_images));
        }
 public ActionResult Edit(C_Images c_images)
 {
     if (ModelState.IsValid)
     {
         db.Entry(c_images).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(c_images));
 }
        public ActionResult DeleteConfirmed(int id)
        {
            C_Images c_images = db.C_Images.Find(id);

            db.C_Images.Remove(c_images);
            db.SaveChanges();

            string fullPath   = Request.MapPath("~/" + c_images.C_Link);
            string fullPathMo = Request.MapPath("~/Mobile" + c_images.C_Link);

            if (System.IO.File.Exists(fullPath))
            {
                System.IO.File.Delete(fullPath);
            }
            if (System.IO.File.Exists(fullPathMo))
            {
                System.IO.File.Delete(fullPathMo);
            }


            return(RedirectToAction("Index"));
        }