private Card MapEntityToCard(Entities.Card cardEntity) => new Card { Id = cardEntity.Id, Name = cardEntity.Name, Definition = MapEntityToCardDefinition(cardEntity.Definition), Properties = JsonConvert.DeserializeObject <List <Property> >(cardEntity.Properties) };
public async Task DeleteCard(int cardId) { var cardEntityToDelete = new Entities.Card { Id = cardId }; context.Cards.Remove(cardEntityToDelete); await context.SaveChangesAsync(); }
public async Task <int> AddCard(AddCardRequest card) { var cardDefinition = await context.CardDefinitions.FindAsync(card.DefinitionId); var cardEntity = new Entities.Card { Definition = cardDefinition, Name = card.Name, Properties = JsonConvert.SerializeObject(card.Properties) }; context.Cards.Add(cardEntity); await context.SaveChangesAsync(); return(cardEntity.Id); }