public ActionResult Add(Filmi F)
        {
            try
            {
                string filename   = Path.GetFileNameWithoutExtension(F.imagefile.FileName);
                string extenction = Path.GetExtension(F.imagefile.FileName);
                filename = filename + DateTime.Now.ToString("yymmssfff") + extenction;
                F.Foto   = "~/fonts/Img/" + filename;
                F.imagefile.SaveAs(Server.MapPath("~/fonts/Img/" + filename));
                filename          = Path.Combine(Server.MapPath("~/fonts/Img/") + filename);
                F.Statusi         = "Activ";
                ViewBag.Kategoria = new SelectList(db.Kategoris, "id_kategori", "Emri", F.Kategoria);
                db.Filmis.Add(F);
                db.SaveChanges();
                TempData["rezsuccess"] = "<script>alert('U shtua me sukses!');</script>";

                ModelState.Clear();
                return(View());
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error u gjend ne Controller Filmi, Add Action", ex);
            }

            return(View());
        }
        // GET: Filmis/Details/5
        public ActionResult Details(int?id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                List <Filma_Salla> Fs = new List <Filma_Salla>();
                Fs = db.Filma_Salla.Where(x => x.Id_Filmi == id && x.Salla.Statusi == "Available").ToList();

                Filmi        F  = db.Filmis.Where(x => x.Id_Filmi == id).FirstOrDefault();
                MovieDetails MV = new MovieDetails();
                MV.filmi       = F;
                MV.filmi_salla = Fs;

                if (MV == null)
                {
                    return(HttpNotFound());
                }
                return(View(MV));
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error u gjend ne Controller Filmi, Details Action", ex);
            }
            return(View());
        }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Filmi filmi = db.Filmis.Find(id);

            db.Filmis.Remove(filmi);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
 public ActionResult Edit([Bind(Include = "Id,Naslov,Izdanm,Tip,Cena")] Filmi filmi)
 {
     if (ModelState.IsValid)
     {
         db.Entry(filmi).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(filmi));
 }
Example #5
0
        public ActionResult Create([Bind(Include = "Id,Naslov,Izdanm,Tip,Cena")] Filmi filmi)
        {
            if (ModelState.IsValid)
            {
                db.Filmis.Add(filmi);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(filmi));
        }
Example #6
0
        // GET: Filmi/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Filmi filmi = db.Filmis.Find(id);

            if (filmi == null)
            {
                return(HttpNotFound());
            }
            return(View(filmi));
        }