Esempio n. 1
0
        public async Task <IResult> AddAsync(CustomerAddDto customerCreateDto)
        {
            var lastUserInsertIdResult = await _userService.GetLastInsertUserAsync();

            if (!lastUserInsertIdResult.Success)
            {
                return(lastUserInsertIdResult);
            }

            var createToCustomer = new Customer()
            {
                CompanyName = customerCreateDto.CompanyName,
                UserId      = lastUserInsertIdResult.Data.Id
            };

            bool addResult = await _customerDal.AddAsync(createToCustomer);

            if (addResult == true)
            {
                return(new SuccessResult(Messages.CustomerAdded));
            }
            else
            {
                return(new ErrorResult(Messages.CustomerNotAdded));
            }
        }
 public async Task AddAsync(Customer customer)
 {
     await _customerDal.AddAsync(customer);
 }
Esempio n. 3
0
 public async Task AddAsync(Customer entity)
 {
     var cancelToken = new CancellationTokenSource();
     await _customerDal.AddAsync(entity, cancelToken.Token);
 }
 public IResult AddAsync(Customer customer)
 {
     _customerDal.AddAsync(customer);
     return(new SuccessResult(CustomerMessages.Added));
 }
Esempio n. 5
0
        public async Task <IResult> Add(Customer customer)
        {
            await _customerDal.AddAsync(customer);

            return(new SuccessResult(Messages.CustomerCreated));
        }