public void OpenDecFile(string fileName)
        {
            var reader = new DecReader();
            var cards  = reader.ReadFile(fileName);

            var sets = _cardDatabase.GetAllSets().ToDictionary(s => s.Ncode);

            foreach (var card in cards)
            {
                if (!string.IsNullOrWhiteSpace(card.CardId))
                {
                    var found = _cardDatabase.FindCardById(card.CardId);
                    if (found != null)
                    {
                        card.SetCode = found.SetCode;
                        if (sets.ContainsKey(card.SetCode))
                        {
                            card.Set = sets[card.SetCode].Nname;
                        }
                    }
                }
                else
                {
                    // TODO: Suche nach namen
                }
            }

            CurrentCards = cards.Select(c => new CardViewModel(c)).ToList();
        }
        public ActionResult UploadDeck(HttpPostedFileBase photo)
        {
            var model = new DeckListModel();

            try
            {
                string directory = Path.GetTempPath();

                if (photo != null && photo.ContentLength > 0)
                {
                    var fileName = Path.Combine(directory, Path.GetFileName(photo.FileName));
                    try
                    {
                        photo.SaveAs(fileName);

                        var reader = new DecReader();
                        var result = reader.ReadFile(fileName);

                        // TODO: Wrap result and add to model

                        model.Cards = result;
                    }
                    finally
                    {
                        var info = new FileInfo(fileName);
                        if (info.Exists)
                        {
                            info.Delete();
                        }
                    }
                }
            }
            catch (Exception error)
            {
            }

            // return RedirectToAction("DeckList");
            return(View(model));
        }