예제 #1
0
        public ActionResult Create([Bind(Include = "ID,Name,Password")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
        public void UploadSetting()
        {
            string             directory = Properties.Settings.Default.SettingsDirectory;
            string             file      = Path.Combine(directory, "Settings.xml");
            string             content   = File.ReadAllText(file);
            UserAccountContext context   = new UserAccountContext();

            User.UserSetting.Content = Encoding.Default.GetBytes(content);
            context.SaveChanges();
        }
예제 #3
0
 public ActionResult RegisterUser(UserAccount user)
 {
     try
     {
         _context.Add(user);
         _context.SaveChanges();
         ViewBag.message = user.Name + "has got successfull";
         return(View("Login"));
     }
     catch (Exception e)
     {
         ViewBag.message = user.Name + "failed";
     }
     return(View());
 }
예제 #4
0
 public ActionResult RegisterUser(UserAccount ua)
 {
     try
     {
         _context.Add(ua);
         _context.SaveChanges();
         ViewBag.message = ua.UserName + " has got successfully Registered";
         return(RedirectToAction("Login"));
     }
     catch (Exception e)
     {
         ViewBag.message = ua.UserName + " Registration Failed!!!";
         return(View());
     }
 }