public AddProvinceDomainEvent( string correlationId, ProvinceDomain province) : base(correlationId) { Province = province; }
public async Task <AddProvinceDto?> Handle( AddProvinceCommand request, CancellationToken token) { var countryDomain = await _countryQueries .GetById( request.CorrelationToken, request.CountryId, token); if (countryDomain == null) { return(null); } var provinceDomain = new ProvinceDomain( request.CorrelationToken, request.Title); countryDomain .ProvinceAdd(provinceDomain); await _countryCommands .UnitOfWork .SaveEntitiesAsync(token); return(new AddProvinceDto( provinceDomain.Id, provinceDomain.Country.Id, provinceDomain.Title)); }
public UpdateTitleProvinceDomainEvent( string correlationId, ProvinceDomain province) : base(correlationId) { Province = province; }
public HttpResponseMessage GetProvince() { HttpResponseMessage httpResponseMessage = new HttpResponseMessage() { StatusCode = HttpStatusCode.OK }; BaseResponse <List <ProvinceAPIViewModel> > response = new BaseResponse <List <ProvinceAPIViewModel> >(); try { ProvinceDomain provinceDomain = new ProvinceDomain(); response = provinceDomain.GetProvince(); } catch (ApiException e) { httpResponseMessage.StatusCode = e.StatusCode; response = BaseResponse <List <ProvinceAPIViewModel> > .Get(e.Success, e.ErrorMessage, null, e.ErrorStatus); } catch (Exception ex) { httpResponseMessage.StatusCode = HttpStatusCode.InternalServerError; response = BaseResponse <List <ProvinceAPIViewModel> > .Get(false, ex.ToString(), null, ResultEnum.InternalError); throw; } httpResponseMessage.Content = new JsonContent(response); return(httpResponseMessage); }
public void Update( string correlationToken, ProvinceDomain province) { _addressesContext .Province .Update(province); }
public async Task <ProvinceDomain> Add( string correlationToken, ProvinceDomain province, CancellationToken token) { var entityEntry = await _addressesContext .Province .AddAsync( province, token); return(entityEntry.Entity); }
public bool ProvinceRemove( string correlationId, ProvinceDomain province) { if (!_provinces .Remove(province)) { return(false); } AddDomainEvent( new RemoveProvinceDomainEvent( correlationId, province)); return(true); }
public void ProvinceAdd( ProvinceDomain province) { _provinces.Add(province); }