public async Task ViewLoadedAsync()
        {
            if (DataIsLoaded)
            {
                return;
            }

            var caller = $"{nameof(BandViewModel)}({_instanceId:N}).{nameof(ViewLoadedAsync)}";

            try
            {
                BusyStatus = "Getting data ...";
                IsBusy     = true;
                Discography.Clear();
                CurrentLineup.Clear();
                var band = await Services.DataService.GetBandAsync(Id);

                IsBusy = false;
                (band as BaseResponse)?.To(this as BaseViewModel);
                band?.Data?.To(this);
                band?.Data?.Details?.To(this);

                DataIsLoaded = true;
            }
            catch (Exception ex)
            {
                var errorId = Invariant($"{DateTime.Now:yyyyMMdd_HHmmss}");
                Logger.Log.Error(ex, "Failed to load band by id.", caller, errorId);
                IsBusy = false;
                MessageBoxService.ShowMessage($"Failed to get band details.{Environment.NewLine}{ex.Message}{Environment.NewLine}See log for more info. Error id is {errorId}.", WindowTitle, MessageButton.OK, MessageIcon.Error);
            }
        }
Exemplo n.º 2
0
 public API(string apiKey)
 {
     Key = apiKey;
       Track = new Track();
       Artist = new Artist();
       Album = new Album();
       Discography = new Discography();
 }
Exemplo n.º 3
0
 public API(string apiKey)
 {
     Key         = apiKey;
     Track       = new Track();
     Artist      = new Artist();
     Album       = new Album();
     Discography = new Discography();
 }
Exemplo n.º 4
0
 public LoadSongsViewModel()
 {
     _artist        = new Artist();
     _album         = new Album();
     _discography   = new Discography();
     _songs         = new List <Song>();
     _artistContact = new ArtistContact();
 }
Exemplo n.º 5
0
        public ActionResult DeleteConfirmed(int id)
        {
            Discography discography = db.Discography.Find(id);

            db.Discography.Remove(discography);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "DiscographyId,CoverImage,Title,Subtitle,Description,OnSaleTime,ProductNumber,Price")] Discography discography)
 {
     if (ModelState.IsValid)
     {
         db.Entry(discography).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(discography));
 }
Exemplo n.º 7
0
        // GET: Discographies/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Discography discography = db.Discography.Find(id);

            if (discography == null)
            {
                return(HttpNotFound());
            }
            return(View(discography));
        }