예제 #1
0
        public async Task <ServiceResponse <UserModel> > CreateUserAsync(UserModel model)
        {
            try
            {
                var createResult = await _userService.CreateUserAsync(ConvertExtension.Convert <ApplicationUser>(model));

                if (createResult.IsSuccessful)
                {
                    var asd = await _userService.GenerateEmailConfirmationTokenAsync(createResult.Data);


                    var callbackUrl = "/Account/ConfirmEmail?userId= " + createResult.Data.Id + "&code=" + asd.Data + "";
                    //var callbackUrl = Url.Page("/Account/ConfirmEmail", pageHandler: null, values: new { userId = user.Id, code = code }, protocol: Request.Scheme);

                    await _emailService.SendEmailAsync(model.Email, "Üyelik Aktifleştirme",
                                                       $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");
                }

                return(new ServiceResponse <UserModel>());
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #2
0
 public ServiceResponse <ParameterModel> GetParameter(int?code = null, string name = null)
 {
     try
     {
         var asd = _parameterRepository.TableNoTracking;
         if (code != null && code > 0)
         {
             asd = asd.Where(x => x.Code == code);
         }
         if (code != null && code > 0)
         {
             asd = asd.Where(x => x.Name.Equals(name));
         }
         var asdd = asd.FirstOrDefault();
         return(new ServiceResponse <ParameterModel>(ConvertExtension.Convert <ParameterModel>(asdd), true, 100, ""));
     }
     catch (System.Exception ex)
     {
         return(new ServiceResponse <ParameterModel>(ex));
     }
 }