private void ResetCardAdd() => CardAdd = new CardAdd { CardSectionId = CardSection.Id };
public static Card ToEntity(this CardAdd add) { return(new Card { Title = add.Title, Description = add.Description, CardSectionId = add.CardSectionId }); }
public async Task <Card> AddAsync(CardAdd toAdd, CancellationToken cancellationToken = default) { var card = toAdd.ToEntity(); card.CreatedOn = DateTime.UtcNow; card.Order = await _context.Cards.MaxAsync(c => (int?)c.Order, cancellationToken) ?? 0 + 1; await _context.AddAsync(card, cancellationToken); await _context.SaveChangesAsync(cancellationToken); return(card); }