public async Task Execute(Update update) { string fileContent = await _updateHelper.GetFileContentsFrom(update); string chatId = update.Message.Chat.Id.ToString(); try { var model = JsonConvert.DeserializeObject <ScheduleModel>(fileContent); await SetupJobs(model, chatId); await _client.SendTextMessageAsync(chatId, StandardMessages.ScheduleSetSuccess); } catch (JsonException) { await _client.SendTextMessageAsync(chatId, StandardMessages.BadFileData); } catch (DataAccessException exc) { await _client.SendTextMessageAsync(chatId, exc.Message); } catch (Exception exc) { _logger.LogError(exc, "Were not able to setup jobs"); throw; } }
public async Task Execute(Update update) { var chatId = update.Message.Chat.Id; string fileContent; try { fileContent = await _updateHelper.GetFileContentsFrom(update); } catch (DataAccessException ex) { await _client.SendTextMessageAsync(chatId, ex.Message); return; } ScheduleUpdateModel model; try { model = JsonConvert.DeserializeObject <ScheduleUpdateModel>(fileContent); } catch (JsonException) { await _client.SendTextMessageAsync(chatId, StandardMessages.BadFileData); return; } try { await _jobs.AddJobsToChatWithExistingSchedule(chatId, model); } catch (DataAccessException ex) { await _client.SendTextMessageAsync(chatId, ex.Message); } await _client.SendTextMessageAsync(chatId, StandardMessages.AddedAlertsSuccess); }