Basically I am learning angular and C#.Net.. Which I am beginning to understand a little bit now.
I have crated a database in which I am adding records from the users input like so:
[HttpPost]
public HttpResponseMessage PostDs72(Persons p)
{
if (p == null)
return new HttpResponseMessage(HttpStatusCode.BadGateway);
PeopleContext db = new PeopleContext();
db.Persons.Add(p);
db.SaveChanges();
return new HttpResponseMessage(HttpStatusCode.Created);
}
n the code above is the c# code that is adding or creating a new person in the table Persons.
And in angular side of things this is what I have done:
And in angular side of things this is what I have done:
$scope.createPerson = function () {
$http({
method: 'POST',
url: '/api/Persons',
data: JSON.stringify($scope.newperson),
headers: { 'Content-Type': 'application/JSON' }
}).success(function (data) {
$scope.status = " Saved";
Getinfo();
}).error(function (error) {
$scope.status = 'Unabale to save ' + error.message;
});
};
this is the angular that code that is creating a new person. or function creating a new person
and in my HTML this is what I have done
and in my HTML this is what I have done
And that is how I am adding people onto my database.
Now I am stuck! How do I go on in about search for record by their last name provided in a search textbox? can some one plsease help?
If this was windows forms I would code something like
Now I am stuck! How do I go on in about search for record by their last name provided in a search textbox? can some one plsease help?
If this was windows forms I would code something like
SELECT * FROM Persons WHERE LastName = '"textbox1.text"'
now ofcourse this is not winsforms but is there anyone that can help?
Thank you
Thank you
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Guest UserPosted Aug 12, 2014, 11:18 PM
Abraham LukwesaPosted Aug 12, 2014, 3:22 AM
Guest UserPosted Aug 12, 2014, 12:21 AM