Example #1
0
        public void FillDatabase()
        {
            Account ac1 = new Account();

            ac1.Username  = "******";
            ac1.Firstname = "Enes";
            ac1.Lastname  = "Celik";
            ac1.Password  = "******";
            ac1.Mail      = "*****@*****.**";

            Account ac2 = new Account();

            ac2.Username  = "******";
            ac2.Firstname = "Ersoy";
            ac2.Lastname  = "Toraman";
            ac2.Password  = "******";
            ac2.Mail      = "*****@*****.**";

            Account ac3 = new Account();

            ac3.Username  = "******";
            ac3.Firstname = "Mert";
            ac3.Lastname  = "Geren";
            ac3.Password  = "******";
            ac3.Mail      = "*****@*****.**";

            Product pr1 = new Product();

            pr1.Name        = "Iphone6";
            pr1.City        = "manisa";
            pr1.Description = "Sıfır sayılır.";


            IAccountDal  accountDal  = IocUtil.Resolve <IAccountDal>();
            IProductDal  producttDal = IocUtil.Resolve <IProductDal>();
            ICategoryDal categoryDal = IocUtil.Resolve <ICategoryDal>();

            accountDal.Add(ac1);
            accountDal.Add(ac2);
            accountDal.Add(ac3);

            producttDal.Add(pr1);
            producttDal.GetList(x => x.Id == ac1.Id);
        }
Example #2
0
        public void Register(Account account, string password)
        {
            byte[] passwordHash, passwordSalt;

            CreatePasswordHash(password, out passwordHash, out passwordSalt);

            account.PasswordHash = passwordHash;
            account.PasswordSalt = passwordSalt;

            _accountDal.Add(account);
        }
        public ResponseModel Add(CreateAccountDto accountDto)
        {
            var account         = _mapper.Map <Account>(accountDto);
            var validateResult  = _accountValidator.Validate(account);
            int referenceNumber = Guid.NewGuid().GetHashCode();

            if (validateResult.IsValid)
            {
                account.Id = Guid.NewGuid().GetHashCode();
                _accountDal.Add(account);

                return(new ResponseModel(referenceNumber, false, Messages.AccountCreated));
            }
            else
            {
                return(new ResponseModel(referenceNumber, true, validateResult.Errors[0].ToString()));
            }
        }
Example #4
0
        public bool Register(Account account)
        {
            if (string.IsNullOrEmpty(account.Firstname.Trim()) || string.IsNullOrEmpty(account.Lastname.Trim()) || string.IsNullOrEmpty(account.Username.Trim()) || string.IsNullOrEmpty(account.Password.Trim()) || string.IsNullOrEmpty(account.Mail.Trim()))
            {
                return(false);
            }

            //user kontrolleri yapılacak.

            if (accountDal.Get(x => x.Username == account.Username) == null && accountDal.Get(x => x.Mail == account.Mail) == null)
            {
                accountDal.Add(account);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #5
0
 public void Add(Account account)
 {
     _accountDal.Add(account);
 }
Example #6
0
 public int Add(AspNetUsers account)
 {
     return(_accountDal.Add(account));
 }
 public IResult Add(Account account)
 {
     _accountDal.Add(account);
     return(new SuccessResult(Messages.AccountAdded));
 }
Example #8
0
 public bool Add(Account entity)
 {
     return(_accountDal.Add(entity));
 }