Example #1
0
        public ActionResult UserLogin([FromBody] AuthenticationModel authenticationModel)
        {
            _logger.LogInformation("POST: api/User/UserLogin Invoke");
            ResponseModel responseModel = new ResponseModel();
            string        message       = "";

            authenticationModel.Password = EncryptionDecryptionHelper.EncryptString(authenticationModel.Password);
            var result = _userService.UserLogin(authenticationModel, message);

            if (result.Item1 == null)
            {
                responseModel.IsSuccess = false;
                responseModel.Message   = result.Item2;
            }
            else if (result.Item2 == "User can login")
            {
                if (result.Item1.RoleId != 5)
                {
                    if (result.Item1.ProfilePhoto != null)
                    {
                        result.Item1.ProfilePhoto = $"{baseUsrl}/{folderLocation}/{result.Item1.UserId}/{result.Item1.ProfilePhoto}";
                    }
                }

                responseModel.Result  = result.Item1;
                responseModel.Message = result.Item2;
            }
            else
            {
                responseModel.Result  = result.Item1;
                responseModel.Message = result.Item2;
            }

            return(Ok(responseModel));
        }
Example #2
0
        public ActionResult PostUser(User user)
        {
            _logger.LogInformation("POST: api/User/PostUser  Invoke");
            user.Password = RandomPassword.RandomGeneratePassword();
            user.Password = EncryptionDecryptionHelper.EncryptString(user.Password);
            ResponseModel responseModel = new ResponseModel();
            var           result        = _userService.PostUser(user, _hostingEnvironment.ContentRootPath.ToString(), folderLocation);

            if (result == null)
            {
                responseModel.IsSuccess = false;
                responseModel.Message   = "Record Not Created";
            }
            else
            {
                EmailServiceHelper emailService = new EmailServiceHelper(_config, _email);
                //Azure SendGrid Email Grid
                if (_isSendMailBySendGrid)
                {
                    emailService.AdminRegMessage(result).Wait();
                }

                ////local Send Email Grid
                //if (!_isSendMailBySendGrid)
                //    emailService.localUserRegMessage(result);

                responseModel.Result = result;
            }

            return(Ok(responseModel));
        }
Example #3
0
        public ActionResult ChangePassword(ChangePassword changePassword)
        {
            changePassword.Password    = EncryptionDecryptionHelper.EncryptString(changePassword.Password);
            changePassword.OldPassword = EncryptionDecryptionHelper.EncryptString(changePassword.OldPassword);
            _logger.LogInformation("GET: api/User/GetUsersByRole/Id  Invoke");
            ResponseModel responseModel = new ResponseModel();
            var           result        = _userService.ChangePassword(changePassword);

            if (result == "Old Password Is Not Correct")
            {
                responseModel.IsSuccess = false;
                responseModel.Message   = "Old Password Is Not Correct";
            }
            else
            {
                responseModel.Result = result;
            }

            return(Ok(responseModel));
        }
Example #4
0
        public ActionResult Updatepassword(Forgotpassword forgotpassword)
        {
            string UserId = (forgotpassword.UserId.Replace("œ", "+").Replace("Ž", "=").Replace("ô", "/"));

            forgotpassword.UserId   = EncryptionDecryptionHelper.DecryptString(UserId);
            forgotpassword.Password = EncryptionDecryptionHelper.EncryptString(forgotpassword.Password);
            _logger.LogInformation("Post: api/MobileUser/Updatepassword Invoke");
            ResponseModel responseModel = new ResponseModel();
            var           result        = _userService.Updatepassword(forgotpassword);

            if (result <= 0)
            {
                responseModel.IsSuccess = false;
                responseModel.Message   = "Record Not Updated";
            }
            else
            {
                responseModel.Result = "Update";
            }
            return(Ok(responseModel));
        }
Example #5
0
        public ActionResult ConfirmCounsellor([FromBody] JObject cofirm)
        {
            var userId            = Convert.ToInt32(cofirm["id"].ToString());
            var password          = cofirm["pswd"].ToString();
            var encriptedPassword = EncryptionDecryptionHelper.EncryptString(password);

            _logger.LogInformation("Post: api/User/ConfirmCounsellor Invoke");
            ResponseModel responseModel = new ResponseModel();
            var           result        = _userService.ConfirmCounsellor(userId, encriptedPassword);

            if (result != null)
            {
                //email
                responseModel.Message = "Success";
                responseModel.Result  = result;
            }
            else
            {
                responseModel.Message = $"User Not Exists";
                responseModel.Result  = result;
            }
            return(Ok(responseModel));
        }