public async Task <ActionResult> Index() { var url = _configuration["BaseUri"]; if (!string.IsNullOrEmpty(url)) { ViewBag.BaseURL = url; } List <TaskDataEntity> taskDataEntity = await _taskDataRepository.GetUserTasksAsync("*****@*****.**"); //string token = GetAccessToken().ToString(); //string userId = "*****@*****.**"; //var pic = GetPhoto(token, userId); return(View(taskDataEntity.OrderByDescending(o => o.TaskDueDate).ToList())); }
protected override async Task <MessagingExtensionResponse> OnTeamsMessagingExtensionQueryAsync(ITurnContext <IInvokeActivity> turnContext, MessagingExtensionQuery query, CancellationToken cancellationToken) { var queryText = string.Empty; var taskParam = query.Parameters?.FirstOrDefault(p => p.Name == "taskTitle"); if (taskParam != null) { queryText = taskParam.Value.ToString(); } string useremail = "Gousia Begum"; List <TaskDataEntity> userTasksData = new List <TaskDataEntity>(); switch (query.CommandId) { case "MyTasks": userTasksData = await _taskDataRepository.GetUserTasksAsync(useremail); break; case "SubscribedTasks": userTasksData = await _taskDataRepository.GetUserSubscribedTasksAsync(useremail); break; default: break; } var filteredTask = userTasksData; if (!string.IsNullOrEmpty(queryText)) { filteredTask = userTasksData.Where(task => task.TaskName.ToLower() == queryText.ToLower() || task.TaskTitle.ToLower() == queryText.ToLower()).ToList(); } if (filteredTask.Count == 0) { return(new MessagingExtensionResponse { ComposeExtension = new MessagingExtensionResult { Type = "message", Text = "No match found.", }, }); } var taskattachments = new List <MessagingExtensionAttachment>(); foreach (var task in filteredTask) { var previewCard = new ThumbnailCard { Title = task.TaskName + " - " + task.TaskTitle, Text = $"Owner - {task.TaskAssignedTo}" + $" ({ task.TaskStatus})", Images = new List <CardImage>() { new CardImage { Url = _configuration["BaseUri"] + "/Images/" + task.TaskPriority + ".png" } } }; var adaptiveCard = _cardHelper.TaskInformationCard(await CreateTaskInfoFromTaskEntity(task)); taskattachments.Add(new MessagingExtensionAttachment { ContentType = AdaptiveCard.ContentType, Content = adaptiveCard, Preview = previewCard.ToAttachment(), }); } // The list of MessagingExtensionAttachments must we wrapped in a MessagingExtensionResult wrapped in a MessagingExtensionResponse. return(new MessagingExtensionResponse { ComposeExtension = new MessagingExtensionResult { Type = "result", AttachmentLayout = "list", Attachments = taskattachments } }); }