Пример #1
0
 public static Column Convert(Deck.Column column, Dictionary<string, Card> cards)
 {
     return new Column
     {
         Cards = column.CardIds.Select(c => cards[c]).ToList(),
     };
 }
Пример #2
0
 public static DeckViewModel Convert(Deck deck, Dictionary<string, Card> cards)
 {
     return new DeckViewModel
     {
         Id = deck.Id,
         Name = deck.Name,
         Columns = deck.Columns.Select(c => Column.Convert(c, cards)).ToList(),
     };
 }
Пример #3
0
        public ActionResult Create(Deck deck)
        {
            if (!ModelState.IsValid)
            {
                throw new Exception("F**k!");
            }

            using (var session = MvcApplication.DocumentStore.OpenSession())
            {
                session.Store(deck);
                session.SaveChanges();

                return RedirectToAction("edit", new { id = deck.Id, slug = deck.Name.Slugify() });
            }
        }