public async Task <Term> UpdateTerm(Term newterm) { Authorizer authorizer = new Authorizer(); Token token = new Token(); token = await authorizer.Authorize(); TermService termService = new TermService(token); Term term = await termService.UpdateObject(newterm); return(term); }
private static async Task <bool> DoTerm(Operations operations) { if (token == null) { Authorizer authorizer = new Authorizer(); Console.WriteLine("calling authorize()"); token = await authorizer.Authorize(); Console.WriteLine("doTerm(): Token=" + token.ToString()); } TermService termService = new TermService(token); if (operations.HasFlag(Operations.C)) { Term newTerm = TermHelper.GenerateObject(); Term term = await termService.CreateObject(newTerm); Console.WriteLine("Term Create: " + term.ToString()); } if (operations.HasFlag(Operations.R)) { Term term = await termService.ReadObject(); Console.WriteLine("Term Read: " + term.ToString()); } if (operations.HasFlag(Operations.U)) { Term newTerm = TermHelper.GenerateObject(); Term term = await termService.UpdateObject(newTerm); Console.WriteLine("Term Update: " + term.ToString()); } if (operations.HasFlag(Operations.D)) { Term term = await termService.DeleteObject(); Console.WriteLine("Term Delete: " + term.ToString()); } return(true); }