public void EditPostTransport(PostTransportCreateDto postTransportCreateDto)
        {
            var post = _postTransportRepository.GetById(postTransportCreateDto.PostId);

            Location locationFrom = post.LocationFrom;

            locationFrom.Country  = _countryRepository.GetByName(postTransportCreateDto.CountryFrom);
            locationFrom.Locality = _localityRepository.GetByName(postTransportCreateDto.LocalityFrom);

            Location locationTo = post.LocationTo;

            locationTo.Country  = _countryRepository.GetByName(postTransportCreateDto.CountryTo);
            locationTo.Locality = _localityRepository.GetByName(postTransportCreateDto.LocalityTo);

            TransportSpecification transportSpecification = post.Specification;

            transportSpecification.Description    = postTransportCreateDto.TransportDescription;
            transportSpecification.WeightCapacity = postTransportCreateDto.WeightCapacity;
            transportSpecification.VolumeCapacity = postTransportCreateDto.VolumeCapacity;

            post.LocationTo    = locationTo;
            post.LocationFrom  = locationFrom;
            post.Specification = transportSpecification;
            post.Price         = postTransportCreateDto.Price;
            PostTransportType postTransportType;

            Enum.TryParse(postTransportCreateDto.PostTransportTypes, true, out postTransportType);
            post.PostTransportType     = postTransportType;
            post.DateFrom              = postTransportCreateDto.DateFrom;
            post.DateTo                = postTransportCreateDto.DateTo;
            post.AdditionalInformation = postTransportCreateDto.AdditionalInfo;

            _postTransportRepository.Update(post);
        }
        public void CreatePostTransport(PostTransportCreateDto postTransportCreateDto, ApplicationUser user)
        {
            Location locationFrom = new Location()
            {
                Country  = _countryRepository.GetByName(postTransportCreateDto.CountryFrom),
                Locality = _localityRepository.GetByName(postTransportCreateDto.LocalityFrom)
            };

            Location locationTo = new Location()
            {
                Country  = _countryRepository.GetByName(postTransportCreateDto.CountryTo),
                Locality = _localityRepository.GetByName(postTransportCreateDto.LocalityTo)
            };

            TransportSpecification transportSpecification = new TransportSpecification()
            {
                Description    = postTransportCreateDto.TransportDescription,
                WeightCapacity = postTransportCreateDto.WeightCapacity,
                VolumeCapacity = postTransportCreateDto.VolumeCapacity
            };

            var postFactory = new PostFactory();
            var post        = postFactory.CreateNewPost(user, postTransportCreateDto.DateFrom, postTransportCreateDto.DateTo, locationFrom, locationTo,
                                                        postTransportCreateDto.PostTransportTypes, postTransportCreateDto.Price, postTransportCreateDto.AdditionalInfo, transportSpecification);

            _locationRepository.Save(locationFrom);
            _locationRepository.Save(locationTo);
            _transportSpecRepository.Save(transportSpecification);
            _postTransportRepository.Save(post as PostTransport);
        }