コード例 #1
0
 public async Task <int> CreateProvinceAsync(ProvinceModelRq model, UserIdentity <int> issuer)
 {
     try
     {
         var province = _mapper.Map <Province>(model);
         province.CreateBy(issuer).UpdateBy(issuer);
         _provinceRepository.Create(province);
         if (await _uow.SaveChangesAsync() == 1)
         {
             return(province.Id);
         }
         return(0);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #2
0
        public async Task <IActionResult> CreateProvince(ProvinceCreationDto dto)
        {
            var newProvince = new ProvinceCreationDto
            {
                Description = dto.Description
            };

            await _provinceRepository.Create(newProvince);

            return(Ok(dto));
        }
コード例 #3
0
        public void Execute(CreateProvince message)
        {
            var item = new Province(0, message.CountryId, message.Name);

            _repository.Create(item);
        }