public async Task EditAsync(Donation e) { var dbDonation = mapper.Map <DbDonation>(e); context.Update(dbDonation); await context.SaveChangesAsync(); }
public async Task EditAsync(Event e) { var dbEvent = mapper.Map <DbEvent>(e); context.Update(dbEvent); await context.SaveChangesAsync(); }
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)); }
public async Task <Person> EditAsync(Person person) { var dbPerson = mapper.Map <DbPerson>(person); context.Update(dbPerson); await context.SaveChangesAsync(); return(person); }
public async Task <Registration> EditAsync(Registration registration) { var dbRegistration = mapper.Map <DbRegistration>(registration); context.Update(dbRegistration); await context.SaveChangesAsync(); return(mapper.Map <Registration>(dbRegistration)); }
public async Task EditAsync(string key, DtoPageData pageData) { var existingDbPageData = await context.PageData.AsNoTracking().FirstOrDefaultAsync(r => r.Key == key); var mappedPageData = mapper.Map <DbPageData>(pageData); // mappedPageData.ID = existingDbPageData.ID; var alteredPageData = mappedPageData with { ID = existingDbPageData.ID }; context.Update(alteredPageData); await context.SaveChangesAsync(); }