public Data.Customer Insert(CustomerUpsert customer)
        {
            var entity = _mapper.Map <Customer>(customer);

            if (customer.Password != customer.PasswordConfirm)
            {
                throw new Exception("Password and password confirm don't match !");
            }

            entity.PasswordSalt = HashGenerator.GenerateSalt();
            entity.PasswordHash = HashGenerator.GenerateHash(entity.PasswordSalt, customer.Password);

            _context.Add(entity);
            _context.SaveChanges();
            return(_mapper.Map <Data.Customer>(entity));
        }
        public Data.Model.Customer Insert(CustomerUpsert request)
        {
            var entity = _mapper.Map <Customer>(request);

            if (request.Password != request.PasswordConfirm)
            {
                throw new Exception("Password and password confirm not matched !");
            }
            entity.PasswordSalt = HashGenerator.GenerateSalt();
            entity.PasswordHash = HashGenerator.GenerateHash(entity.PasswordSalt, request.Password);

            _context.Add(entity);
            _context.SaveChanges();

            return(_mapper.Map <Data.Model.Customer>(entity));
        }