How to check that my web api is working or not?
How to create an alert in web api?
below is my code for crud operation.
public HttpResponseMessage PostCategories(Categories cat)
{
cat = repository.Insert(cat);
var response = Request.CreateResponse<Categories>(HttpStatusCode.Created, cat);
string uri = Url.Link("DefaultApi", new { categoryID = cat.CategoryID });
response.Headers.Location = new Uri(uri);
return response;
}
public HttpResponseMessage PutCategories(int CategoryID, Categories cat)
{
cat.CategoryID = CategoryID;
if (!repository.Update(cat))
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound, " CategoryID :" + CategoryID);
}
else
{
return Request.CreateResponse(HttpStatusCode.OK);
}
}