Ejemplo n.º 1
0
        public ActionResult Movie(FormCollection col)
        {
            MovieUserDataContext db = new MovieUserDataContext();
            Movie  moviedata        = new Movie();
            string moviename        = col.Get("moviename");
            string releaseyear      = col.Get("releaseyear");
            string genre            = col.Get("genre");

            if (moviename == "")
            {
                return(Json(new { status = 0, message = "Movie Name harus diisi" }, JsonRequestBehavior.AllowGet));
            }
            else if (releaseyear == "")
            {
                return(Json(new { status = 0, message = "Release Year harus diisi" }, JsonRequestBehavior.AllowGet));
            }
            else if (genre == "")
            {
                return(Json(new { status = 0, message = "Genre harus dipilih" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                moviedata.MovieName   = moviename;
                moviedata.ReleaseYear = DateTime.Parse(releaseyear);
                moviedata.GenreID     = Int32.Parse(genre);

                db.Movies.InsertOnSubmit(moviedata);
                db.SubmitChanges();
                return(Json(new { status = 1, message = "Berhasil Input Movie" }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Pengguna(FormCollection col)
        {
            MovieUserDataContext db       = new MovieUserDataContext();
            Pengguna             userdata = new Pengguna();
            string username = col.Get("username");
            string fullname = col.Get("fullname");
            string password = col.Get("password");

            if (username == "")
            {
                return(Json(new { status = 0, message = "User Name harus diisi" }, JsonRequestBehavior.AllowGet));
            }
            else if (fullname == "")
            {
                return(Json(new { status = 0, message = "Full Name harus diisi" }, JsonRequestBehavior.AllowGet));
            }
            else if (password == "")
            {
                return(Json(new { status = 0, message = "Password harus diisi" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                userdata.UserName  = username;
                userdata.FullName  = fullname;
                userdata.Password  = password;
                userdata.CreatedOn = DateTime.Now;
                db.Penggunas.InsertOnSubmit(userdata);
                db.SubmitChanges();
                return(Json(new { status = 1, message = "Berhasil Input User" }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Collection(FormCollection col)
        {
            MovieUserDataContext db             = new MovieUserDataContext();
            Collection           collectiondata = new Collection();
            string moviecol = col.Get("moviecol");

            CollectionModel cm     = new CollectionModel();
            bool            moviec = cm.ValidateCollectionMovie(moviecol);

            if (moviec == false)
            {
                return(Json(new { status = 0, message = "Movie harus ada di list" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                collectiondata.UserName            = Convert.ToString(Session["UserName"]);
                collectiondata.MovieID             = Int32.Parse(moviecol);
                collectiondata.CreatedOnCollection = DateTime.Now;

                db.Collections.InsertOnSubmit(collectiondata);
                db.SubmitChanges();
                return(Json(new { status = 1, message = "Berhasil Input Movie" }, JsonRequestBehavior.AllowGet));
            }
        }