Esempio n. 1
0
        public ResponseModel <List <AccountsModel> > CreateAccount(AccountsModel model)
        {
            if (_repo.DoesAccountNoExist(model.AccountNumber))
            {
                return(FailResponse(2, "Account Number exists"));
            }

            return(_repo.CreateAccount(model));
        }
Esempio n. 2
0
        public IActionResult Create([FromBody] DataFromPage data)
        {
            if (contactsRepository.IsContactInSystem(data.contactEmail) == false)
            {
                return(StatusCode((int)HttpStatusCode.NotFound));
            }
            Contact accountContact = contactsRepository.GetContactByEmail(data.contactEmail);
            Account newAccount     = new Account {
                Name = data.accountName, ContactId = accountContact.Id
            };

            accountsRepository.CreateAccount(newAccount);
            return(Ok());
        }
        public JsonResult CreateAccount(FormCollection form)
        {
            var account = new AccountDto
            {
                Role     = Convert.ToInt32(form["role"]),
                Name     = form["name"],
                Surname  = form["surname"],
                UserName = form["userName"],
                Email    = form["email"],
                Password = form["password"],
            };

            var result = _repository.CreateAccount(account);

            return(Json(new
            {
                type = result ? "OK" : "Error",
                message = result ? "Poprawnie dodano użytkownika" : "Wystąpił błąd!"
            }));
        }
Esempio n. 4
0
 public async Task <IActionResult> Create(CreateAccountModel model)
 {
     if (ModelState.IsValid)
     {
         if (await _accountRepository.CreateAccount(model.Username, model.Password))
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError(nameof(CreateAccountModel.Username), "De gebruikersnaam is al in gebruik.");
             return(View(model));
         }
     }
     else
     {
         // Invalid model state
         return(View(model));
     }
 }
Esempio n. 5
0
 public async Task CreateAccount(CreateAccountRequest request)
 {
     await _accountsRepository.CreateAccount(request.Name, request.StartingBalance, request.AccountTypeId);
 }