public IHttpActionResult Delete(int networkId, int id) { _credentials.SetCredentials(Request.Headers.Authorization.Parameter); var userId = _userRep.Get(_credentials.Email, _credentials.Password).Id; if (!_networkRep.GetAll().Any(n => n.Id == networkId && n.User_Id == userId)) { var errorMessage = _messages.GetMessage(Custom.NotFound, "Network", "Id"); return(NotFound(errorMessage)); } if (_gatewayRep.Exists(id)) { _gatewayRep.Delete(id); } return(StatusCode(HttpStatusCode.NoContent)); }