コード例 #1
0
 public string Post(RegisterViewModel model)
 {
     model.SelectedRole = "Admin";
     if (ModelState.IsValid)
     {
         double userDomainKey = _registerUserService.GetMaxUserDomainKey();
         var    user          = new User
         {
             PhoneNumber   = model.PhoneNumber,
             UserName      = model.Email,
             Email         = model.Email,
             UserDomainKey = Convert.ToInt64(userDomainKey) + 1   //giving the Max+1 domain key
         };
         string errorString;
         User   addedUser = AddUser(user, model, out errorString);
         if (addedUser != null)
         {
             //_registerUserService.AddLicenseDetail(model, user.UserDomainKey);
             _registerUserService.SaveUserDetails(addedUser, model);
             return(SendEmailToUser(addedUser, model));
         }
         if (!string.IsNullOrEmpty(errorString))
         {
             throw new CaresException(errorString);
         }
     }
     throw new CaresException("Failed to register!");
 }