public IActionResult DeleteItem(int id, string type) { switch (type) { case "tbl_userdata": MollShopContext.DeleteRow(type, "fld_UserId", id); EsUpdater <tbl_userdata> .DeleteDocument(id, "User", "moll_users"); break; case "tbl_servicedata": MollShopContext.DeleteRow(type, "fld_serviceid", id); EsUpdater <tbl_servicedata> .DeleteDocument(id, "Services", "moll_dataservices"); break; case "tbl_labourerdata": MollShopContext.DeleteRow(type, "fld_labourerid", id); EsUpdater <tbl_labourerdata> .DeleteDocument(id, "Labourer", "moll_labourers"); //Delete the OLS for this labourer as well break; case "offeredlabourerservice": MollShopContext.DeleteRow("tbl_offeredservicesdata", "fld_offeredServiceId", id); EsUpdater <OfferedLabourerService> .DeleteDocument(id, "OLS", "moll_ols"); break; default: break; } return(Ok()); }