private async Task <Person> addDBPersonAsync(DbPerson dbPerson) { await context.Persons.AddAsync(dbPerson); await context.SaveChangesAsync(); return(mapper.Map <Person>(dbPerson)); }
public async Task <Donation> AddAsync(Donation donation) { var newDonation = mapper.Map <DbDonation>(donation); context.Donations.Add(newDonation); await context.SaveChangesAsync(); return(mapper.Map <Donation>(newDonation)); }
public async Task <Event> AddAsync(Event @event) { var newEvent = mapper.Map <DbEvent>(@event); context.Events.Add(newEvent); await context.SaveChangesAsync(); return(mapper.Map <Event>(newEvent)); }
public async Task <Registration> AddAsync(Registration registration) { var dbRegistration = mapper.Map <DbRegistration>(registration); context.Registrations.Add(dbRegistration); await context.SaveChangesAsync(); return(mapper.Map <Registration>(dbRegistration)); }
public async Task <DtoPageData> AddAsync(DtoPageData pageData) { var dbPageData = mapper.Map <DbPageData>(pageData); await context.PageData.AddAsync(dbPageData); await context.SaveChangesAsync(); return(mapper.Map <DtoPageData>(dbPageData)); }
public async Task <Team> AddAsync(Team team) { var existingEvent = await EntityFrameworkQueryableExtensions.FirstOrDefaultAsync(context.Events, c => c.ID == team.EventID); var newTeam = team.WithEventId(existingEvent.ID); var dbTeam = mapper.Map <DbTeam>(newTeam); await context.Teams.AddAsync(dbTeam); existingEvent.Teams.Add(dbTeam); context.Update(existingEvent); await context.SaveChangesAsync(); return(mapper.Map <Team>(dbTeam)); }