c# - Windows Store App and a WebApi -


i'm having bit of trouble recent windows store app , webapi.

i'm trying login system on it, , had working console application + asp.net webapi.

here's console application code:

using (var client = new httpclient()) {   console.writeline("insira o username");   string nome = console.readline();   console.writeline("insira password");   string password = console.readline();    client.baseaddress = new uri("http://localhost:49800"); // variavel global   client.defaultrequestheaders.accept.clear();   client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json"));    users usrlogin = new users() { login = nome, password = password };   var response = client.postasjsonasync("api/employees/login", usrlogin).result;    if (response.issuccessstatuscode) 

basically, i'm creating users object , send webapi, makes checking db.

how can "translate" windows store application?

the high level approach windows store app be,

  • to construct users object getting inputs app, maybe text box control
  • to send object web api

refer consuming web api xaml. has sample implementation of web api call windows store app. hope helps


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -