public async Task <ConferenceDetails> AddNewConferenceAsync(ConferenceDetails conference) { var conf = _mapper.Map <Model.Conference>(conference); _conferencesDbContext.Conferences.Add(conf); await _conferencesDbContext.SaveChangesAsync(); return(_mapper.Map <Shared.DTO.ConferenceDetails>(conf)); }
public async Task <ConferenceDetails> AddNewConferenceAsync(ConferenceDetails conference) { var conf = _mapper.Map <Model.Conference>(conference); conf.DateCreated = DateTime.UtcNow; _conferencesDbContext.Conferences.Add(conf); await _conferencesDbContext.SaveChangesAsync(); await _hubContext.Clients.All.SendAsync("NewConferenceAdded"); return(_mapper.Map <Shared.DTO.ConferenceDetails>(conf)); }
public async Task <ActionResult <Shared.DTO.ConferenceDetails> > PostConference(Shared.DTO.ConferenceDetails conference) { if (!ModelState.IsValid) { return(BadRequest()); } var conf = _mapper.Map <Model.Conference>(conference); _conferencesDbContext.Conferences.Add(conf); await _conferencesDbContext.SaveChangesAsync(); return(CreatedAtAction("Get", new { id = conference.ID }, _mapper.Map <Shared.DTO.ConferenceDetails>(conf))); }
public async Task <ActionResult <Shared.DTO.ConferenceDetails> > PostConference(Shared.DTO.ConferenceDetails conference) { if (!_validator.IsValidPeriod(conference.DateFrom, conference.DateTo)) { return(BadRequest()); } var conf = _mapper.Map <Conference>(conference); _conferencesDbContext.Conferences.Add(conf); await _conferencesDbContext.SaveChangesAsync(); await _hubContext.Clients.All.SendAsync("NewConferenceAdded"); return(CreatedAtAction("Get", new { id = conference.ID }, _mapper.Map <Shared.DTO.ConferenceDetails>(conf))); }
public async Task <ActionResult <ConferenceDetails> > PostConference(ConferenceDetails conference) { if (!ModelState.IsValid) { return(BadRequest()); } var conf = _mapper.Map <Conference>(conference); _context.Conferences.Add(conf); await _context.SaveChangesAsync(); await _hubContext.Clients.All.SendAsync("NewConferenceAdded"); return(CreatedAtAction("GetConference", new { id = conference.ID }, conf)); }
public async Task <ActionResult <Shared.DTO.ConferenceDetails> > PostConference(Shared.DTO.ConferenceDetails conference) { if (!ModelState.IsValid) { return(BadRequest()); } var conf = _mapper.Map <Model.Conference>(conference); conf.DateCreated = DateTime.UtcNow; _conferencesDbContext.Conferences.Add(conf); await _conferencesDbContext.SaveChangesAsync(); await _hubContext.Clients.All.SendAsync("NewConferenceAdded"); return(CreatedAtAction("Get", new { id = conference.ID }, _mapper.Map <Shared.DTO.ConferenceDetails>(conf))); }
public async Task AddAsync(Host host) { await _hosts.AddAsync(host); await _context.SaveChangesAsync(); }
public async Task <int> CompleteAsync() { return(await _context.SaveChangesAsync()); }
public async Task AddAsync(Conference conference) { await _conferences.AddAsync(conference); await _dbContext.SaveChangesAsync(); }