Пример #1
0
 // POST tables/User
 public IHttpActionResult PostUser(RegisterRequest request)
 {
     try
     {
         string errorMessage = ValidationUtilities.ValidateUserDetails(request);
         var    domainObj    = DbUtilities.GetDomainDetails(request.Email);
         if (errorMessage.Equals(string.Empty))
         {
             string otpCode   = AuthorizationUtilities.GenerateOTPCode();
             string userEmail = HttpUtilities.GetUserNameFromToken(this.Request);
             DbUtilities.SaveTheUser(request, otpCode, domainObj, userEmail, request.IsActiveUser);
             AuthorizationUtilities.SendOTPtoUser(request.Email, otpCode);
             return(Ok(HttpUtilities.CustomResp(ErrorCodes.USER_CREATED.ToString())));
         }
         else
         {
             return(BadRequest(errorMessage));
         }
     }
     catch (Exception ex)
     {
         LGSELogger.Error(ex);
         return(InternalServerError(ex));
     }
     //return CreatedAtRoute("Tables", new { id = current.Id }, current);
 }
Пример #2
0
 public IHttpActionResult SignUp(RegisterRequest request)
 {
     try
     {
         string errorMessage = ValidationUtilities.ValidateUserDetails(request);
         var    domainObj    = DbUtilities.GetDomainDetails(request.Email);
         if (errorMessage.Equals(string.Empty))
         {
             string otpCode = AuthorizationUtilities.GenerateOTPCode();
             DbUtilities.SaveTheUser(request, otpCode, domainObj, request.Email, true);
             AuthorizationUtilities.SendOTPtoUser(request.Email, otpCode);
             return(Ok(HttpUtilities.CustomResp(ErrorCodes.USER_REGISTERED.ToString())));
         }
         else
         {
             return(BadRequest(errorMessage));
         }
     }
     catch (Exception ex)
     {
         LGSELogger.Error(ex);
         return(InternalServerError(ex));
     }
 }