Exemple #1
0
        public ActionResult Index()
        {
            if (!_db.Users.Any())
            {
                var user = new User
                {
                    Email    = "*****@*****.**",
                    Name     = "Admin",
                    Role     = UserRoleType.Admin,
                    Password = RNGCryptoService.CreateHash("abcd1234"),
                };
                _db.Users.Add(user);
                _db.SaveChanges();
            }
            var temp = DbCache.Instance.CanditStatus;

            if (IsAuth)
            {
                return(SafeRedirect());
            }
            return(View(new SignInRequest()));
        }
 public JsonResult Edit(UserCreateVm model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             string msg  = string.Empty;
             var    user = model.IsNew
                         ? new User()
                         : _db.Users.Find(model.UserId);
             if (user.Email != model.Email)
             {
                 _userSrv.ValidateEmailUnique(model.Email);
             }
             user.UpdateUserCreateVm(model);
             if (model.IsNew)
             {
                 _db.Users.Add(user);
                 user.Password = RNGCryptoService.CreateHash("rh1234");
                 msg           = "User Created";
             }
             else
             {
                 _db.Entry(user).State = System.Data.EntityState.Modified;
                 msg = "User Modified";
             }
             _db.SaveChanges();
             _userSrv.AddUserLog(user.UserId, msg);
         }
         catch (SimpleException ex)
         {
             AddModelError(ex);
         }
     }
     return(GetErrorMsgJSON());
 }
Exemple #3
0
 public Dendrite()
 {
     Weight = RNGCryptoService.Generate();
 }