HiBeen having issue with Xamarin Cross Platform Android Project. I am using Wep Api Project to call a service from xamarin portable project.
-
- var auth = new SigninModel
- {
- Username = username,
- Password = password
-
- };
-
-
-
- var stringContent = new StringContent(JsonConvert.SerializeObject(auth), Encoding.UTF8, "application/json");
- var response = await Client.PostAsync("http://localhost:54019/api/AuthenticationApi/Login", stringContent);
-
-
-
- [System.Web.Http.Route("api/AuthenticationApi/Login/")]
- [System.Web.Http.AcceptVerbs("GET", "POST")]
- [System.Web.Http.HttpPut]
- public DBResult Login(AuthenticationModel model)
- {
- SupervisorModel result = null;
- bool hasError = false;
- string errorText = "";
-
- if (ModelState.IsValid)
- {
- result = Authentication.AuthenticateUser(model.Username, model.Password);
-
- }
- else
- {
- hasError = true;
-
- }
-
- return new DBResult { status = !hasError ? "Success" : "Fail", descripText = BadRequest(ModelState).ToString(), data = new SupervisorModel { Id = result.Id, Name = result.Name, Surname = result.Surname } };
-
- }