Exemplo n.º 1
0
 public Command(Guid packetUid, CountryCodeValue countryCode, PacketVersionValue packetVersion, PacketVersionValue currentVersion)
 {
     PacketUid      = packetUid;
     CountryCode    = countryCode;
     PacketVersion  = packetVersion;
     CurrentVersion = currentVersion;
 }
        public async Task <IActionResult> Get([FromRoute] Guid packetUid, [FromRoute] int version, [FromQuery] string country, [FromQuery] int versionFrom)
        {
            var countryCodeValue       = CountryCodeValue.Create(country);
            var packetVersionValue     = PacketVersionValue.Create(version);
            var packetVersionFromValue = PacketVersionValue.Create(versionFrom);

            PacketVersionValue.CheckIfVersionToUpdateIsNotDowngrade(versionFrom, version);

            var result = await MediatorService.SendAsync(new UpdatePacket.Command(packetUid, countryCodeValue, packetVersionValue, packetVersionFromValue));

            return(Ok(result));
        }