Exemplo n.º 1
0
        public IHttpActionResult CreateVendor(CreateVendorModel model)
        {
            var enSaltKey  = _encryptionService.CreateSaltKey(4);
            var enPassword = _encryptionService.CreatePasswordHash(model.Password, enSaltKey);

            if (model == null)
            {
                return(NotFound());
            }
            Vendor vendor = new Vendor()
            {
                Email      = model.Email,
                Mobile     = model.Mobile,
                Name       = model.Name,
                Membership = new Membership()
                {
                    PasswordSalt = enSaltKey,
                    Password     = enPassword,
                    UserName     = model.Email,
                    CreatedOn    = DateTime.Now,
                    Role         = _roleRepository.First(new Specification <Role>(r => r.Name == "Vendor"))
                }
            };

            using (var uow = _unitOfWorkFactory.Create())
            {
                _vendorRepository.Add(vendor);
            }
            return(Ok(vendor));
        }
Exemplo n.º 2
0
 public TideResponse CreateVendor([FromBody] CreateVendorModel model)
 {
     return(_tideProtocol.CreateVendor(model.Account, model.Username, model.PublicKey, model.Description));
 }