I'm using ASP.NET web server, it works well with Postman but doesn't work with my arduino. Please help me. Sorry my english is not good.
[HttpGet]
public Student GetStudent(string ID)
{
StudentServerDbContext db = new StudentServerDbContext();
var query = (from a in db.iSTUDENTs
where a.STUDENTID == ID
select a);
var data = query.Select(x => new Student
{
_08STATUS = x.iPERMISSION.STUDENTSTATUS,
}).First();
return data;
}
public class Student
{
public string _08STATUS { get; set; }
}
[HttpPost]
public bool UpdateOut(string ID)
{
. . .
b.INOUTID = 0;
b.STUDENTID = ID;
b.OUTTIME = DateTime.Now;
b.INTIME = DateTime.Now;
db.iINOUTs.Add(b);
}
db.SaveChanges();
return true;
}
return false;
}
[HttpPut]
public bool UpdateIn(string ID)
{
. . .
b.INTIME = DateTime.Now;
}
db.SaveChanges();
return true;
}
return false;
}
.INO
client.println("GET /api/student/" + id + " HTTP/1.1");
client.println("Host: 192.168.1.1");
client.println();
…
client.find(":\"");
client.readBytesUntil('\"', _status, sizeof(_status));
myGLCD.print("Status: ", 170, 150);
myGLCD.print(_status, 265, 150);
…
if(strcmp(_status,"IN") == 0){
client.println("POST /api/student/" + id + " HTTP/1.1");
client.println("Host: 192.168.1.1");
client.println("Connection: close");
client.println("Content-Type: application/x-www-form-urlencoded");
client.println("Content-Length: 0");
client.println();
}
else {
client.println("PUT /api/student/" + id + " HTTP/1.1");
client.println("Host: 192.168.1.1");
client.println("Connection: close");
client.println("Content-Type: application/x-www-form-urlencoded");
client.println("Content-Length: 0");
client.println();
}