public static async void PostTodo(PostTodo todoModel) { var json = JsonConvert.SerializeObject(todoModel); using (var content = new StringContent(json, Encoding.UTF8, "application/json")) { var respones = await ApiHelper.client.PostAsync("todo", content); respones.EnsureSuccessStatusCode(); } }
public IActionResult NewTodo(Models.TodoModel todoModel) { if (ModelState.IsValid) { var todo = new TodoDataLibrary.PostTodo(); todo.title = todoModel.Title; todo.desc = todoModel.Desc; todo.estimate = todoModel.Estimate; TodoProcessor.PostTodo(todo); return(RedirectToAction("Index")); } return(View()); }