コード例 #1
0
ファイル: UserController.cs プロジェクト: jakemedal/ChatLoco
        public ActionResult CreateUser(CreateUserRequestModel request)
        {
            //CreateUserResponseModel response = Mapper.Map<CreateUserRequestModel, CreateUserResponseModel>(request);
            var response = new CreateUserResponseModel()
            {
                Username = request.Username,
                Email    = request.Email
            };

            response.Errors = UserService.CreateUser(request.Username, request.Email, request.Password); //this creates a user and returns errors if it cannot

            return(Json(response));
        }
コード例 #2
0
        public CreateUserResponseModel CreateUser([FromBody] CreateUserModel model)
        {
            var responseModel = new CreateUserResponseModel();

            //ilk olarak bu email ile daha önce kayıt yapılmış mı kontrol etmeliyiz

            try
            {
                var isExist = UserManager.IsExistUserByEmail(model.Email);

                if (isExist == true)
                {
                    responseModel.IsSuccess    = false;
                    responseModel.ErrorMessage = "Bu email ile daha önce kullanıcı oluşturulmuştur!!";
                    return(responseModel);
                }


                //daha önce kayıt yapılmadıysa bu bilgiler ile kullanıcıyı oluşturalım

                UserManager.InsertUser(model);
                responseModel.IsSuccess    = true;
                responseModel.ErrorMessage = "";

                string mailSubject = "Üyelik aktivasyonu";
                string mailBody    = $"Aşağıdaki linke giderek üyeliğinizi aktif hale getirebilirsiniz!\n www.biga.vaktihazar.com/UserProcess/ActivateUser?email={model.Email}";

                MailHelper.SendSmtpMail(mailSubject, mailBody, model.Email);


                return(responseModel);
            }
            catch (Exception ex)
            {
                responseModel.IsSuccess    = false;
                responseModel.ErrorMessage = ex.Message;
                return(responseModel);
            }
        }
コード例 #3
0
 public void Respond(CreateUserResponseModel model)
 {
     _response = RedirectToAction("Show");
 }