Exemplo n.º 1
0
        //uses link from email to verify the email
        public ActionResult VerifyEmail()
        {
            //fetches the email being verified and fetches the account associated with the email
            string  email    = Cryptography.Decrypt(sessionWrapper.EmailToVerify, "verify");
            Account _account = accountDAL.FetchByEmail(email);

            //updates the account
            if (_account != null)
            {
                _account.isVerified = true;
                accountDAL.Update(_account);
                TempData["successMessage"] = "Account has been verified ! ";
                return(RedirectToAction("Login"));
            }

            //shows error message if account can't be updated
            else
            {
                TempData["errorMessage"] = "We couldn't verify your account ! ";
                return(RedirectToAction("Login"));
            }
        }
Exemplo n.º 2
0
        public ActionResult Edit(EditViewModel model)
        {
            if (ModelState.IsValid)
            {
                Account _account = GetAccount();
                var     account  = accountDAL.FetchByID(_account.accountID);

                if (account != null)
                {
                    account.Profile.jobID        = model.jobID;
                    account.firstName            = model.firstName;
                    account.lastName             = model.lastName;
                    account.Profile.businessName = model.businessName;
                    account.Profile.description  = model.description;
                    account.Profile.location     = model.location;
                    account.Profile.website      = model.website;
                    account.Profile.youtube      = model.youtube;
                    //account.Profile.startYear = model.startYear;
                    account.Profile.additionalInfo = model.additionalInfo;
                    account.Profile.updateDate     = DateTime.Now;
                    account.updateDate             = DateTime.Now;

                    var existingUsername = profileDAL.FetchByUsername(model.userName);
                    if (existingUsername != null)
                    {
                        TempData ["errorMessage"] = "That username is already in use";
                    }

                    else if (existingUsername == null)
                    {
                        account.Profile.userName = model.userName;
                    }

                    accountDAL.Update(account);
                    return(RedirectToAction("MyProfile"));
                }

                else if (account == null)
                {
                    TempData ["errorMessage"] = "That account does not exist.";
                }
            }

            model.Jobs = jobDAL.FetchAll();
            return(View(model));
        }
Exemplo n.º 3
0
 public bool Update(Account entity)
 {
     return(_accountDAL.Update(entity) > 0);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Update的对象,必须通过Single()获取重置属性后操作!传入实体修改,根据传入的实体主健修改,如果是new出来的实体,则要把Single()的对象赋给他才可更新
 /// </summary>
 /// <returns>返回,成功:true,失败:false</returns>
 public bool Update(Account entity)
 {
     return(dal.Update(entity));
 }