Beispiel #1
0
 public ActionResult addmovie(tblmovy moviename, tblmovy movietyp, tblmovy desc)
 {
     dbmovie.tblmovies.Add(moviename);
     dbmovie.tblmovies.Add(movietyp);
     dbmovie.tblmovies.Add(desc);
     dbmovie.SaveChanges();
     return(View());
 }
        public ActionResult Create([Bind(Include = "Id,Name")] Film film)
        {
            if (ModelState.IsValid)
            {
                db.Film.Add(film);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(film));
        }
        public ActionResult Create(movie amovie, HttpPostedFileBase file)
        {
            try
            {
                if (Session["LogedUserId"] != null)
                {
                    string userId = Session["LogedUserId"].ToString();
                    string login  = Session["LogedLogin"].ToString();
                    amovie.userId = Convert.ToInt32(userId);
                    amovie.user   = login;
                    var movie = (from m in _db.movie where m.userId == amovie.userId select m).FirstOrDefault();

                    if (file != null)
                    {
                        string path = Path.Combine(Server.MapPath("~/UploadedFiles"), Path.GetFileName(file.FileName));

                        file.SaveAs(path);
                        amovie.file = Path.GetFileName(file.FileName);

                        //movie.poster = new byte[image.ContentLength];
                        //var fghfh = movie.poster;
                        ///image.InputStream.Read(movie.poster, 0, image.ContentLength);
                    }
                    ViewBag.FileStatus = "File uploaded successfully.";

                    if (movie == null)
                    {
                        _db.movie.Add(amovie);
                        _db.SaveChanges();
                    }
                }


                //return View(amovie);
                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                ViewBag.FileStatus = "Error while file uploading." + e.Message;
                return(View());
            }
        }
Beispiel #4
0
 public ActionResult addtheatre(tbltheatre theatrename)
 {
     dbtheatre.tbltheatres.Add(theatrename);
     dbtheatre.SaveChanges();
     return(View(theatrename));
 }
Beispiel #5
0
 public ActionResult editlocation(tbllocation data)
 {
     dblocation.Entry(data).State = EntityState.Modified;
     dblocation.SaveChanges();
     return(View(data));
 }