public async Task <IActionResult> Post([FromBody] AddCustomerTypeViewModel model)
        {
            if (model == null)
            {
                return(BadRequest());
            }

            if (await _customerTypeRepo.IsExistNameAsync(model.Name))
            {
                ModelState.AddModelError("Name", Resources.Global.Common.ThisNameExist);
                return(BadRequest(ModelState.GetWithErrorsKey()));
            }

            var customerType = new CustomerType(model.Name, model.Note);

            var affectedRows = await _customerTypeRepo.AddAsync(customerType);

            if (affectedRows > 0)
            {
                var viewModel = AutoMapper.Mapper.Map <CustomerTypeViewModel>(customerType);

                return(CreatedAtRoute("GetCustomerType", new { id = customerType.Number }, viewModel));
            }
            return(BadRequest());
        }