Exemple #1
0
 public UpdateResponse Get([FromBody] ClientData data)
 {
     if (_validateService.ValidateClientData(data.PackageId, data.VersionId, data.Software, out Guid packageId, out Guid versionId))
     {
         var update = _updateService.GetUpdate(packageId, versionId, data.Software, data.Country);
         if (update != null && update.UpdateFiles.Count() > 0)
         {
             return(PrepareVersionsModel(update));
         }
         else
         {
             return(EmptyUpdateResponse());
         }
     }
Exemple #2
0
        public async Task <ActionResult> Get([FromBody] ClientData data)
        {
            if (_validateService.ValidateClientData(data.PackageId, data.VersionId, data.Software, out Guid packageId, out Guid versionId))
            {
                var update     = _updateService.GetUpdate(packageId, versionId, data.Software, data.Country);
                var zippedFile = await _zipService.ReturnZippedUpdateBytes(update?.UpdateFiles?.Select(uf => uf.File).ToList(), _hostingEnvironment.ContentRootPath);

                if (zippedFile != null)
                {
                    return(new FileContentResult(zippedFile, System.Net.Mime.MediaTypeNames.Application.Zip)
                    {
                        FileDownloadName = "Update.zip"
                    });
                }
                else
                {
                    return(NotFound());
                }
            }