Esempio n. 1
0
 public static CardSection ToEntity(this CardSectionAdd add)
 {
     return(new CardSection {
         Title = add.Title,
         ProjectId = add.ProjectId
     });
 }
Esempio n. 2
0
        public async Task <CardSection> AddAsync(CardSectionAdd toAdd, CancellationToken cancellationToken = default)
        {
            var cardSection = toAdd.ToEntity();

            cardSection.CreatedOn = DateTime.UtcNow;
            cardSection.Order     = await _context.CardSections.MaxAsync(c => (int?)c.Order, cancellationToken) ?? 0 + 1;

            await _context.AddAsync(cardSection, cancellationToken);

            await _context.SaveChangesAsync(cancellationToken);

            return(cardSection);
        }
 private void InitAdd() => CardSectionAdd = new CardSectionAdd
 {
     ProjectId = ProjectId
 };