public IActionResult AddConcert(ConcertDto concertDto) { var entity = new ConcertEntity(); _eventMapper.FillConcertEntityWithDto(concertDto, entity); _eventRepository.AddEvent(entity); return(CreatedAtAction("GetEvent", new { eventId = entity.Id }, entity)); }
public void Store(Concert aggregateRoot) { if ((aggregateRoot as IHasDomainEvents).NewlyCreated()) { var snapshot = ConcertSnapshot.CreateFrom(aggregateRoot); _db.Concerts.Add(ConcertEntity.FromConcertSnapshot(snapshot)); _db.SaveChanges(); } else { Update(aggregateRoot); } }
public void Delete(Concert aggregateRoot) { _db.Concerts.Remove(ConcertEntity.FromConcertSnapshot(ConcertSnapshot.CreateFrom(aggregateRoot))); _db.SaveChanges(); }
public void FillConcertEntityWithDto(ConcertDto dto, ConcertEntity entity) { FillEventEntityWithDto(dto, entity); entity.ArtistCosts = dto.ArtistCosts; }