public JsonResult OnGetServicoPreview(string id, string mth) { JsonResult rjson; ButtonPressed = mth; GetPeriod(mth); if (ButtonPressed == "Year") { var user_atendimentos = Task.Run(() => _appAtendimento.ByServicos(id, Periodo)); user_atendimentos.Wait(); rjson = new JsonResult(user_atendimentos.Result); } else { var user_atendimentos = Task.Run(() => _appAtendimento.ByServicosMonth(id, Periodo)); user_atendimentos.Wait(); rjson = new JsonResult(user_atendimentos.Result); } return(rjson); }