public async Task <IActionResult> Criar() { Session session = GetSession(); CriarTarefaViewModel criarTarefa = new CriarTarefaViewModel(); if (!session.eGestor) { return(View(criarTarefa)); } ApiConnection client = new ApiConnection($"usuario/gestor/{session.idUsuario}/subordinados", session.token); HttpResponseMessage response = await client.Client.GetAsync(client.Url); // string result; if (response.IsSuccessStatusCode) { // result = await response.Content.ReadAsStringAsync(); // criarTarefa.Subordinados = JsonConvert.DeserializeObject<List<Usuario>>(result); criarTarefa.Subordinados = DeserializeObject <List <Usuario> >(response).Result; client.Close(); } else if (response.StatusCode == HttpStatusCode.BadRequest || response.StatusCode == HttpStatusCode.InternalServerError) { return(RedirectToAction("Index", "Error", new { Erro = "Ocorreu um erro com o envio do formulario." })); } return(View(criarTarefa)); }
public CriarTarefaView() { InitializeComponent(); vm = new CriarTarefaViewModel(); BindingContext = vm; }