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; } }
public async Task <IActionResult> CreateProvince(ProvinceCreationDto dto) { var newProvince = new ProvinceCreationDto { Description = dto.Description }; await _provinceRepository.Create(newProvince); return(Ok(dto)); }
public void Execute(CreateProvince message) { var item = new Province(0, message.CountryId, message.Name); _repository.Create(item); }