Exemplo n.º 1
0
 public async Task <String> Register_Post(AccountNewDTO account)
 {
     try
     {
         if (ModelState.IsValid)
         {
             return("ok" + (await handler.Create(account, Request)).acct_AccountID);
         }
         else
         {
             return("no");
         }
     }
     catch (Exception ex)
     {
         if (ex.Message == ConstantHelper.ALREADY_REQUEST_LOAN ||
             ex.Message == ConstantHelper.KEY_IN_REQUIRED_FIELD ||
             ex.Message == ConstantHelper.INVALID_PIN ||
             ex.Message == ConstantHelper.PIN_EXPIRED ||
             ex.Message == ConstantHelper.PHONE_EXIST ||
             ex.Message == ConstantHelper.EMAIL_EXIST)
         {
             Response.StatusCode = 400;
         }
         else
         {
             Response.StatusCode = 500;
         }
         return(ex.Message.ToString());
     }
 }
Exemplo n.º 2
0
 public async Task <IHttpActionResult> Create(AccountNewDTO newDTO)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         return(Ok(await handler.Create(newDTO)));
     }
     catch (HttpException ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Exemplo n.º 3
0
        public bool Create(Account account)
        {
            AccountDTO accountDTO = new AccountDTO(account.AccountID, account.LoginCode, account.Name, account.Password, (int)account.Team);

            return(handler.Create(accountDTO));
        }