Пример #1
0
        public IDataResult <User> Register(UserForRegisterDto userForRegisterDto, string password)
        {
            var userToCheck = _userService.GetByMail(userForRegisterDto.Email);

            if (userToCheck == null)
            {
                byte[] passwordHash, passwordSalt;
                HashingHelper.CreatePasswordHash(password, out passwordHash, out passwordSalt);
                var user = new User
                {
                    Email        = userForRegisterDto.Email,
                    FirstName    = userForRegisterDto.FirstName,
                    LastName     = userForRegisterDto.LastName,
                    PasswordHash = passwordHash,
                    PasswordSalt = passwordSalt,
                    Status       = true
                };
                _userService.Add(user);
                var user1    = _userService.GetByMail(user.Email);
                var customer = new Customer {
                    UserId = user1.Id, CompanyName = $"{user1.FirstName} {user1.LastName}"
                };
                _customerService.Add(customer);
                var userFindex = new UserFindex {
                    UserId = user1.Id
                };
                _findexService.Add(userFindex);
                var userOperationClaim = new UserOperationClaim {
                    UserId = user1.Id
                };
                _claimService.Add(userOperationClaim);
                return(new SuccessDataResult <User>(user, Messages.UserRegistered));
            }
            return(new ErrorDataResult <User>(Messages.UserAlreadyExists));
        }
Пример #2
0
        public IResult Add(UserFindex entity)
        {
            Random random = new Random();

            entity.FindexPuan = random.Next(0, 1900);
            _userFindexDal.Add(entity);
            return(new SuccessResult());
        }
Пример #3
0
        public IActionResult Add(UserFindex userFindex)
        {
            var result = _userFindexService.Add(userFindex);

            if (result.Success == true)
            {
                return(Ok(result));
            }
            return(BadRequest());
        }
Пример #4
0
        public IActionResult UserFindexUpdate(UserFindex userFindex)
        {
            var result = _userFindexService.Update(userFindex);

            if (result.Success)
            {
                return(Ok(result));
            }

            return(BadRequest(result));
        }
Пример #5
0
 public IResult Update(UserFindex userFindex)
 {
     _userFindexDal.Update(userFindex);
     return(new SuccessResult("Güncelleme işlemi basarılı"));
 }
Пример #6
0
 public IResult Add(UserFindex userFindex)
 {
     _userFindexDal.Add(userFindex);
     return(new SuccessResult("Ekle işlemi basarılı"));
 }
Пример #7
0
 public IResult Update(UserFindex entity)
 {
     _userFindexDal.Update(entity);
     return(new SuccessResult());
 }