Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
Postasync works with UWP but breaks on android project
Anele Ngqandu
7y
308
1
Reply
Hi
Been having issue with Xamarin Cross Platform Android Project. I am using Wep Api Project to call a service from xamarin portable project.
//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);
//WebApi
[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 } };
}
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Show table form details based on distinct in PowerApps
"Resource. Id.file_settings" does not contain application