public async Task<IActionResult> CreateMeet(MeetDTO meetDTO) { var meet = _mapper.Map<Reunion>(meetDTO); await _meetService.InsertMeet(meet); meetDTO = _mapper.Map<MeetDTO>(meet); var apiResponse = new ApiResponse<MeetDTO>(meetDTO); return Ok(apiResponse); }
public async Task<IActionResult> Put(int id, MeetDTO meetDTO) { var meet = _mapper.Map<Reunion>(meetDTO); meet.Id = id; await _meetService.UpdateMeet(meet); meetDTO = _mapper.Map<MeetDTO>(meet); var apiResponse = new ApiResponse<MeetDTO>(meetDTO); return Ok(apiResponse); }
public async Task AddMeetWithInvitations(MeetDTO dto, List <int> users) { using (var db = await _unit.CreateTransaction()) { var idNewMeet = await _unit.Meets.Add(dto); foreach (int userId in users) { await _unit.Invitations.Add(idNewMeet, userId); } await db.CommitAsync(); } }
public async Task <int> Add(MeetDTO dto) { Meet newMeet = new Meet() { Address = dto.Address, City = dto.City, Date = dto.Date, Title = dto.Title, }; await _context.AddAsync(newMeet); await _context.SaveChangesAsync(); return(newMeet.Id); }