Beispiel #1
0
        // GET: Country_Videos/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index"));
            }
            Country_Videos country_Videos = db.Country_Videos.Find(id);

            if (country_Videos == null)
            {
                return(HttpNotFound());
            }
            return(View(country_Videos));
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Country_Videos country_Videos = db.Country_Videos.Find(id);

            db.Country_Videos.Remove(country_Videos);
            db.SaveChanges();
            FileInfo F = new FileInfo(Server.MapPath("~/Uploads/Country_Videos/" + id + ".mp4"));

            if (F.Exists)
            {
                F.Delete();
            }
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "ID,Description,Country_ID")] Country_Videos country_Videos, HttpPostedFileBase Video)
        {
            try
            {
                if (ModelState.IsValid && Video != null)
                {
                    country_Videos.Description_en = DEL.TranslateText(country_Videos.Description, "ar|en");
                    db.Country_Videos.Add(country_Videos);
                    db.SaveChanges();
                    Video.SaveAs(Server.MapPath("~/Uploads/Country_Videos/" + country_Videos.ID + ".mp4"));
                    ViewBag.Done = "تم الاضافة";
                }
            }catch (Exception ex)
            {
                ViewBag.error = ex.Message;
            }

            return(View(country_Videos));
        }