I have a POST Method which is working fine it takes a list of object and add it to the database with Entity Framework AddRange
I tried to apply the same logic with the DELETE method (takes list of objects and delete it from the database with RemoveRange) it does return 200 OK but does not delete from the database
POST
[HttpPost]
public HttpResponseMessage Post(List<Provider_status> rows)
{
try
{
using (DbModel dbModel = new DbModel())
{
dbModel.Provider_status.AddRange(rows);
dbModel.SaveChanges();
}
}
catch { }
return new HttpResponseMessage()
{
Content = new StringContent("Records Added")
};
}
DELETE method
[HttpDelete]
public HttpResponseMessage Delete(List<Provider_status> rows)
{
try
{
using (DbModel dbModel = new DbModel())
{
dbModel.Provider_status.RemoveRange(rows);
dbModel.SaveChanges();
}
}
catch { }
return new HttpResponseMessage()
{
Content = new StringContent("Records Deleted")
};
}
[HttpDelete]attribute from the action?HttpDeletebut same results