コード例 #1
0
 public ActionResult Register(User user)
 {
     return View();
 }
コード例 #2
0
 public ActionResult Install(User usr, HttpPostedFileBase ava)
 {
     bool imVald = usr.IsAdmin = true;
     if (ava != null) {
         imVald = ava.ContentLength < 204800;
         if (!imVald)
             ModelState.AddModelError("", "Слишком большой размер изображения.");
     }
     if (imVald && ModelState.IsValid) {
         usr.ConfirmPassWord = usr.PassWord = Hash.CreateHash(usr.PassWord);
         AvatarUploader upl = new AvatarUploader();
         Thread t = new Thread(upl.LoadAvatar);
         t.Start(new object[] { ava, usr.Login });
         con.Users.Add(usr);
         con.SaveChanges();
         return RedirectToAction("Index");
     }
     return View("Install", usr);
 }
コード例 #3
0
 public ActionResult EditProfiles(User user)
 {
     return View();
 }
コード例 #4
0
 public ActionResult Install()
 {
     #if !DEBUG
     int cnt = con.Users.Count();
     if (cnt > 0)
         return RedirectToAction("Index");
     #endif
     #if(DEBUG)
     User usr = new User() { IsAdmin = true, Login = "******", Email = "*****@*****.**", DateBorn = new DateTime(1984, 11, 11), Name = "Иван", Family = "Гуркин", LastName = "Александрович" };
     #else
     User usr = new User() { IsAdmin = true, Id = "admin" };
     #endif
     return View(usr);
 }