Ejemplo n.º 1
0
        public async Task <GroupViewModel> Handle(CreateGroupCommand request, CancellationToken cancellationToken)
        {
            var entity = new Group
            {
                Id          = Guid.NewGuid(),
                Name        = request.Name,
                Description = request.Description,
                IsActive    = request.IsActive
            };

            await _genericRepository.AddAsync(entity);

            _genericRepository.SaveChanges();

            return(_mapper.Map <GroupViewModel>(entity));
        }
        public async Task <CardViewModel> Handle(CreateCardCommand request, CancellationToken cancellationToken)
        {
            var entity = new Card
            {
                Id          = Guid.NewGuid(),
                Description = request.Description,
                Synonmys    = request.Synonmys,
                Meaning     = request.Meaning,
                Chapter     = request.Chapter,
                Verse       = request.Verse
            };

            await _genericRepository.AddAsync(entity);

            _genericRepository.SaveChanges();

            return(_mapper.Map <CardViewModel>(entity));
        }
Ejemplo n.º 3
0
 public async Task <T> AddAsync(T entity)
 {
     return(await _GenericRepositoryAsync.AddAsync(entity));
 }