private async void CreateNewClient()
        {
            CreateTrainerRequest createTrainerRequest = new CreateTrainerRequest
            {
                FirstName   = tbIme.Text,
                LastName    = tbPrezime.Text,
                Email       = tbEmail.Text,
                Password    = tbPassword.Text,
                Address     = tbAdresa.Text,
                PhoneNumber = tbTelefon.Text
            };

            await _apiService.Create <Trainer>(createTrainerRequest);
        }
Example #2
0
        public Models.Trainers.Trainer Create(CreateTrainerRequest createTrainerRequest)
        {
            Database.AppUser appUser = _mapper.Map <Database.AppUser>(createTrainerRequest);
            appUser.HashedPassword = HashUtil.ComputeSha256Hash(createTrainerRequest.Password);
            appUser.CreatedAt      = DateTime.UtcNow;
            appUser.Status         = Database.UserStatus.ACTIVE;

            // add trainer specific data
            Database.Trainer trainer = new Database.Trainer();
            appUser.Trainer = trainer;

            _context.AppUsers.Add(appUser);
            _context.SaveChanges();
            return(_mapper.Map <Models.Trainers.Trainer>(appUser));
        }
 public Models.Trainers.Trainer Create(CreateTrainerRequest createTrainerRequest)
 {
     _authenticationService.IsAuthorized(Request, "EMPLOYEE");
     validateModel();
     return(_trainersService.Create(createTrainerRequest));
 }