コード例 #1
0
        public ActionResult Register(string fname, string uname, string pass)
        {
            User u = new User();

            u.FullName = fname;
            u.UserName = uname;
            u.Password = pass;

            if (db.Users.FirstOrDefault(x => x.UserName == uname) != null)
            {
                ViewBag.Er = "Username already has taken ☺";
            }
            else
            {
                db.Users.Add(u);
            }


            if (db.SaveChanges() > 0)
            {
                ViewBag.Succ = "Succesfully Registered ☻";
                return(View("Login"));
            }


            return(View());
        }
コード例 #2
0
 public ActionResult Yorum(int id,string comment)
 {
     Comment c = new Comment();
     c.Movies = db.Movies.Find(id);
     c.Description = comment;
     c.UserId = (int)Session["id"];
     db.Comments.Add(c);
     db.SaveChanges();
     return RedirectToAction("Index", "Movies");
 }