public ReturnMessage Post(AppUserVM appUserVM) { try { if (!ModelState.IsValid) { return(new ReturnMessage { ID = 0, Success = false, Message = "Please enter valid entries." }); } var passwordSalt = Guid.NewGuid().ToString(); var originalPassword = appUserVM.szPassword.Trim(); appUserVM.szPassword = Encryption.SaltEncrypt(originalPassword, passwordSalt); appUserVM.szPasswordSalt = passwordSalt.ToString(); appUserVM.dCreatedOn = DateTime.Now; appUserVM.szUsername = appUserVM.szUsername.Trim(); appUserVM.iChangePW = false; appUserVM.iStatus = 0; var retVal = _IAppUserRepository.AddAppUser(appUserVM.ToEntity()); //Successful if (retVal.isSuccess) { //Check if username is email address if (_RegexUtilities.ContainsAlphabet(appUserVM.szUsername.Trim())) { //Send Email Notification _Notification.SendEMail(appUserVM.szUsername.Trim(), "Welcome to GameZone.", "Thank you for joining <b>GameZone</b>. <br/> Your registration was successful.<br/> <br/><a style='background:#ff6a00; color: #ffffff; font-family:bitsumishi !important; padding:6px 12px; font-weight:400;text-align:center; vertical-align: middle; cursor: pointer; border:1px solid transparent; border-radius:4px; text-decoration: none;' href='http://www.gamezone.ng/'> Login </a>"); } return(new ReturnMessage { ID = long.Parse(retVal.id), Success = true, Message = retVal.message }); } else { return(new ReturnMessage { ID = (bool)appUserVM.isMobile ? 101 : 0,//MTN Number indicator (IsMobile) Data = GetAuthenticateUser(appUserVM.szUsername, "password").Data, Success = false, Message = "Sorry, " + appUserVM.szUsername + " already exists. Please try a different UserID." }); } } catch (Exception ex) { return(new ReturnMessage { Success = false, Message = ex.Message }); } }