public Task <int> Add(ProposalDto proposalDto) { var entity = ConferenceAdapter.FromProposalDtoToProposal(proposalDto); _dbContext.Proposals.Add(entity); return(_dbContext.SaveChangesAsync()); }
public Task <int> Add(AttendeeDto attendeeDto) { var entity = ConferenceAdapter.FromAttendeeDtoToAttendee(attendeeDto); _dbContext.Attendees.Add(entity); return(_dbContext.SaveChangesAsync()); }
public Task <int> Add(ConferenceDto conferenceDto) { var entity = ConferenceAdapter.FromConferenceDtoToConference(conferenceDto); _dbContext.Conferences.Add(entity); return(_dbContext.SaveChangesAsync()); }
public async Task <ProposalDto> Approve(int proposalId) { var proposal = await _dbContext.Proposals.FirstAsync(p => p.ProposalId == proposalId); proposal.Approved = true; await _dbContext.SaveChangesAsync(); return(ConferenceAdapter.FromProposalToProposalDto(proposal)); }
public Task <List <ProposalDto> > GetAllForConference(int conferenceId) { return(_dbContext.Proposals.Where(p => p.ConferenceId == conferenceId).Select(p => ConferenceAdapter.FromProposalToProposalDto(p)).ToListAsync()); }
public async Task <ConferenceDto> GetById(int conferenceId) { var entity = await _dbContext.Conferences.FirstAsync(c => c.ConferenceId == conferenceId); return(ConferenceAdapter.FromConferenceToConferenceDto(entity)); }
public Task <List <ConferenceDto> > GetAll() { return(_dbContext.Conferences.Include(c => c.Attendees).Select(c => ConferenceAdapter.FromConferenceToConferenceDto(c)).ToListAsync()); }