示例#1
0
        public async Task <ActionResult <CreationResult> > CreateVersionInfo(AppVersionData newAppVersion, int id = -1)
        {
            int appId = id == -1 ? (int)newAppVersion.AppID : id;


            AppVersion toAdd = new AppVersion
            {
                AppID         = appId,
                Changelog     = newAppVersion.Changelog,
                VresionName   = newAppVersion.VresionName,
                VresionNumber = newAppVersion.VresionNumber,
                ReleaseDate   = newAppVersion.ReleaseDate,
                ChannelID     = newAppVersion.ChannelID
            };

            _context.AppVersions.Add(toAdd);
            await _context.SaveChangesAsync();

            _context.Entry(toAdd).Reference(x => x.Channel).Load();
            _context.Entry(toAdd).Reference(x => x.App).Load();
            Channel channel = toAdd.Channel;

            if (channel.ChannelName.ToLower() == "release")
            {
                App app = toAdd.App;
                if (app.Published)
                {
                    await _notificationsHub.SendNotification("new version" + newAppVersion.VresionNumber + " of " + app.Name);
                }
            }
            return(new CreationResult {
                txt = "Done", ID = toAdd.ID + ""
            });
        }
 private Task GetVersionData()
 {
     try
     {
         if (this._data != null)
         {
             return((Task)Task.FromResult <AppVersionData>(this._data));
         }
         using (HttpClient httpClient = new HttpClient((HttpMessageHandler)HttpClientHelpers.GetClientHandler(true)))
             this._data = (AppVersionData)JsonConvert.DeserializeObject <AppVersionData>(httpClient.GetStringAsync(this._blob).GetAwaiter().GetResult());
     }
     catch (Exception ex)
     {
         CrossMobileAnalytics.Current.TrackException(ex, (IDictionary <string, string>)null, nameof(GetVersionData), "/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Services/AppVersionService.cs", 146);
     }
     return((Task)Task.FromResult <AppVersionData>(this._data));
 }