public async Task <ServiceResponse <bool> > DeleteBotFromDialogAsync(BotDialogAddDTO botDialogDTO) { ServiceResponse <bool> serviceResponse = new ServiceResponse <bool>(); try { BotDialog botDialog = _mapper.Map <BotDialog>(botDialogDTO); _botRepository.DeleteBotFromDialog(botDialog); await _myDBContext.SaveChangesAsync(); serviceResponse.Data = true; return(serviceResponse); } catch (Exception ex) { serviceResponse.Success = false; serviceResponse.Message = ex.Message; return(serviceResponse); } }
public async Task <ServiceResponse <string> > AddBotToDialogAsync(BotDialogAddDTO botDialogDTO) { ServiceResponse <string> serviceResponse = new ServiceResponse <string>(); try { BotDialog botDialog = _mapper.Map <BotDialog>(botDialogDTO); _botRepository.AddBotToDialog(botDialog); await _myDBContext.SaveChangesAsync(); serviceResponse.Data = botDialog.BotName; return(serviceResponse); } catch (Exception ex) { serviceResponse.Success = false; serviceResponse.Message = ex.Message; return(serviceResponse); } }
public void DeleteBotFromDialog(BotDialog botDialog) { _context.BotDialogs.Remove(botDialog); }
public void AddBotToDialog(BotDialog botDialog) { _context.BotDialogs.Add(botDialog); }