Exemplo n.º 1
0
        public async Task <int> Add(AttendeeModel attendee)
        {
            var entity = EntityModelAdapter.FromAttendeeModelToAttendee(attendee);

            _dbContext.Attendees.Add(entity);
            return(await _dbContext.SaveChangesAsync());
        }
        public async Task <int> Add(ProposalModel model)
        {
            var entity = EntityModelAdapter.FromProposalModelToProposal(model);

            _dbContext.Proposals.Add(entity);
            return(await _dbContext.SaveChangesAsync());
        }
        public async Task <ProposalModel> Approve(int proposalId)
        {
            var proposal = await _dbContext.Proposals.FirstAsync(p => p.ProposalId == proposalId);

            proposal.Approved = true;
            await _dbContext.SaveChangesAsync();

            return(EntityModelAdapter.FromProposalToProposalModel(proposal));
        }
Exemplo n.º 4
0
 public async Task <int> Add(ConferenceModel model)
 {
     try
     {
         var entity = EntityModelAdapter.FromConferenceModelToConference(model);
         _dbContext.Conferences.Add(entity);
         return(await _dbContext.SaveChangesAsync());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 5
0
        public async Task <ConferenceModel> GetById(int conferenceId)
        {
            var entity = await _dbContext.Conferences.FirstAsync(c => c.ConferenceId == conferenceId);

            return(EntityModelAdapter.FromConferenceToConferenceModel(entity));
        }
Exemplo n.º 6
0
        public async Task <List <ConferenceModel> > GetAll()
        {
            try
            {
                var conferences = await _dbContext.Conferences.Include(c => c.Attendees).Select(c => EntityModelAdapter.FromConferenceToConferenceModel(c)).ToListAsync();

                return(conferences);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public async Task <List <ProposalModel> > GetAllForConference(int conferenceId)
 {
     return(await _dbContext.Proposals.Where(p => p.ConferenceId == conferenceId).Select(p => EntityModelAdapter.FromProposalToProposalModel(p)).ToListAsync());
 }