示例#1
0
    public async Task EditAsync(Donation e)
    {
        var dbDonation = mapper.Map <DbDonation>(e);

        context.Update(dbDonation);
        await context.SaveChangesAsync();
    }
示例#2
0
    public async Task EditAsync(Event e)
    {
        var dbEvent = mapper.Map <DbEvent>(e);

        context.Update(dbEvent);
        await context.SaveChangesAsync();
    }
示例#3
0
    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));
    }
示例#4
0
    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));
    }
示例#6
0
    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();
    }