public void AddTask(Task newTask) { try { var addedTask = new AddedTask { type = newTask.Type, text = newTask.Text, date = newTask.Date }; var request = new RestRequest("/user/tasks", Method.POST); request.AddHeader("x-api-key", _apiToken); request.AddHeader("x-api-user", _apiUser); //var jsonObj = JsonConvert.SerializeObject(addedTask); request.RequestFormat = DataFormat.Json; request.AddBody(addedTask); var response = _restClient.Execute(request); var error = response.ErrorMessage; } catch (Exception ex) { var message = ex.Message; } }
protected virtual void OnAddedTask(DuelTask addedTask) { AddedTask?.Invoke(this, addedTask); }