예제 #1
0
 public UserAccountModel Create(UserAccount item)
 {
     return new UserAccountModel()
                {
                    Url = _urlHelper.Link("UserAccount", new { id = item.ID }),
                    Fullname = item.Username,
                    LastCreate = item.Created
                };
 }
예제 #2
0
        public UserAccount GetUserByUserName(string username, string password)
        {
            var usr = _uow.UserAccounts.FilterBy(u => u.Username == username).FirstOrDefault();
            if (usr == null)
            {
                var pass = CalculateMD5Hash(password);
                var user = oms.tbl_profile.Where(p => p.S_EMAIL_P == username && p.S_PASSWORD == pass).FirstOrDefault();
                var account = new UserAccount();
                account.Init(user.S_EMAIL_P, user.S_PASSWORD, user.S_EMAIL_P);
                return account;
            }
            if (usr.VerifyHashedPassword(password))
                return usr;

            return null;
        }
예제 #3
0
 public ActionResult Create(UserAccount userAccount)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             var vm = UserAccount.Init(userAccount.Username, userAccount.HashedPassword, userAccount.Email);
             _uow.UserAccounts.Add(vm);
             _uow.Save();
         }
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }