public async Task <bool> DeleteSponsor(int sponsorId) { try { var sponsor = await GetSponsorById(sponsorId); _dbContext.Remove(sponsor); await _dbContext.SaveChangesAsync(); return(true); } catch (Exception ex) { throw ex; } }
public async Task <bool> RemoveUserAgendaItem(int agendaItemId, string userId) { try { var item = await _dbContext.UserAgendaItem.Where(i => i.AgendaItemId == agendaItemId).Where(i => i.UserId == userId).FirstOrDefaultAsync(); _dbContext.Remove(item); await _dbContext.SaveChangesAsync(); return(true); } catch (Exception ex) { throw ex; } }
public async Task <bool> DeleteSpeaker(int speakerId) { try { var speaker = await GetSpeakerById(speakerId); var items = await _dbContext.AgendaItemSpeaker.Where(i => i.SpeakerId == speakerId).ToListAsync(); _dbContext.RemoveRange(items); _dbContext.Remove(speaker); await _dbContext.SaveChangesAsync(); return(true); } catch (Exception ex) { throw ex; } }